<?php
/**
 * @package     SP Soccer
 * @author      JoomShaper http://www.joomshaper.com
 * @copyright   Copyright (C) 2010 - 2016 JoomShaper. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die('Restricted access');

class SpsoccerTableGroup extends FOFTable{

	public function check() {

		$result = true;

		//Tags
		if (is_array($this->spsoccer_gameteam_id))
		{
			if (!empty($this->spsoccer_gameteam_id))
			{
				$this->spsoccer_gameteam_id = json_encode($this->spsoccer_gameteam_id);
			}
		}
		if (is_null($this->spsoccer_gameteam_id) || empty($this->spsoccer_gameteam_id))
		{
			$this->spsoccer_gameteam_id = '';
		}

		return $result;
	}

	public function onAfterLoad(&$result) {

		if(!is_array($this->spsoccer_gameteam_id)) {
			if(!empty($this->spsoccer_gameteam_id)) {
				$this->spsoccer_gameteam_id = json_decode($this->spsoccer_gameteam_id, true);
			}
		}

		if(is_null($this->spsoccer_gameteam_id) || empty($this->spsoccer_gameteam_id)) {
			$this->spsoccer_gameteam_id = array();
		}

		return parent::onAfterLoad($result);
	}
}
