114 lines
2.0 KiB
PHP

<?php
// No direct access.
defined('_JEXEC') or die;
class ClubsPlace extends AbstractClubsModel
{
protected $name;
protected $address;
protected $area;
protected $clubid;
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*/
public function setName(string $name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* @return string
*/
public function getArea()
{
return $this->area;
}
/**
* @param string $address
*/
public function setAddress(string $address)
{
$this->address = $address;
}
/**
* @param string $area
*/
public function setArea(string $area)
{
$this->area = $area;
}
public function getClub()
{
return ClubsClub::loadClub($this->clubid);
}
public function setClub($club)
{
$this->clubid = $club->getId();
}
protected function __construct()
{}
public static function loadPlaces()
{
return self::loadElements(self::tableName, self::className);
}
public static function loadPlacesOfClub($clubId)
{
return self::loadElements(self::tableName, self::className, "clubid = $clubId");
}
public static function loadPlace(int $id)
{
return self::loadElement($id, self::tableName, self::className);
}
public static function createPlace()
{
$place = new ClubsPlace();
$place->id = 'new';
return $place;
}
protected function getDataMappings()
{
return array('name', 'address', 'area', 'clubid');
}
private const tableName = '#__club_places';
private const className = 'ClubsPlace';
protected function getTableName()
{
return self::tableName;
}
}