Added code to simplify setting values
This commit is contained in:
parent
ed47052a59
commit
a9caa06e02
@ -45,6 +45,14 @@ abstract class AbstractCommonClubsModel
|
||||
$this->values = $values;
|
||||
}
|
||||
|
||||
protected function setValue($key, $value)
|
||||
{
|
||||
if(is_null($this->values))
|
||||
$this->loadDataFromDatabase();
|
||||
|
||||
$this->values[$key] = $value;
|
||||
}
|
||||
|
||||
public function markAsNew($new)
|
||||
{
|
||||
$this->new = $new;
|
||||
|
@ -20,4 +20,18 @@ class CommonClubsModelPlace extends AbstractCommonClubsModel
|
||||
return $this->getValues()['club'];
|
||||
}
|
||||
|
||||
public function getArea()
|
||||
{
|
||||
return $this->getValues()['area'];
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->setValue('name', $name);
|
||||
}
|
||||
|
||||
public function setArea($area)
|
||||
{
|
||||
$this->setValue('area', $area);
|
||||
}
|
||||
}
|
@ -24,6 +24,8 @@ class ClubsViewTest extends HtmlView
|
||||
$id = $p->getId();
|
||||
|
||||
$places = $c->getPlaces();
|
||||
// $places[0]->setName("abc");
|
||||
// $places[0]->save();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user