diff --git a/src/admin/common/abstract/model.php b/src/admin/common/abstract/model.php index 2d891d0..1d00ba2 100644 --- a/src/admin/common/abstract/model.php +++ b/src/admin/common/abstract/model.php @@ -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; diff --git a/src/admin/common/models/place.php b/src/admin/common/models/place.php index c8619f3..f64d134 100644 --- a/src/admin/common/models/place.php +++ b/src/admin/common/models/place.php @@ -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); + } } \ No newline at end of file diff --git a/src/admin/views/test/view.html.php b/src/admin/views/test/view.html.php index 94eafec..75186ca 100644 --- a/src/admin/views/test/view.html.php +++ b/src/admin/views/test/view.html.php @@ -24,6 +24,8 @@ class ClubsViewTest extends HtmlView $id = $p->getId(); $places = $c->getPlaces(); +// $places[0]->setName("abc"); +// $places[0]->save(); parent::display($tpl); }