Changed cacheing of attributes to be useful

This commit is contained in:
Christian Wolf 2019-05-23 18:15:22 +02:00
parent 7bf2386851
commit dec4bb5165
4 changed files with 7 additions and 7 deletions

View File

@ -33,13 +33,13 @@ abstract class AbstractCommonClubsModelFactory
* - optional: boolean, if true, the field can be NULL
* - ref: (only with type='ref') The name of the class that is referenced
*/
public abstract function getAttributes();
protected abstract function fetchAttributes();
private $attributes = null;
private function fetchAttributes($force = False)
public function getAttributes($force = False)
{
if($this->attributes === null || $force)
$this->attributes = $this->getAttributes();
$this->attributes = $this->fetchAttributes();
return $this->attributes;
}
@ -128,7 +128,7 @@ abstract class AbstractCommonClubsModelFactory
$attribs = array_map(function($v){
return Null;
}, $this->fetchAttributes());
}, $this->getAttributes());
$obj->setValues($attribs);
$obj->fillDefaultValues();

View File

@ -5,7 +5,7 @@ defined('_JEXEC') or die;
class CommonClubsModelFactoryClub extends AbstractCommonClubsModelFactory
{
public function getAttributes()
public function fetchAttributes()
{
return array(
'name'=>array(),

View File

@ -5,7 +5,7 @@ defined('_JEXEC') or die;
class CommonClubsModelFactoryPlace extends AbstractCommonClubsModelFactory
{
public function getAttributes()
public function fetchAttributes()
{
return array(
'name'=>array(),

View File

@ -5,7 +5,7 @@ defined('_JEXEC') or die;
class CommonClubsModelFactoryUser extends AbstractCommonClubsModelFactory
{
public function getAttributes()
public function fetchAttributes()
{
return array(
'user'=>array(),