Changed cacheing of attributes to be useful
This commit is contained in:
		
							parent
							
								
									7bf2386851
								
							
						
					
					
						commit
						dec4bb5165
					
				@ -33,13 +33,13 @@ abstract class AbstractCommonClubsModelFactory
 | 
				
			|||||||
     *  - optional: boolean, if true, the field can be NULL
 | 
					     *  - optional: boolean, if true, the field can be NULL
 | 
				
			||||||
     *  - ref: (only with type='ref') The name of the class that is referenced
 | 
					     *  - 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 $attributes = null;
 | 
				
			||||||
    private function fetchAttributes($force = False)
 | 
					    public function getAttributes($force = False)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if($this->attributes === null || $force)
 | 
					        if($this->attributes === null || $force)
 | 
				
			||||||
            $this->attributes = $this->getAttributes();
 | 
					            $this->attributes = $this->fetchAttributes();
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
        return $this->attributes;
 | 
					        return $this->attributes;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -128,7 +128,7 @@ abstract class AbstractCommonClubsModelFactory
 | 
				
			|||||||
        
 | 
					        
 | 
				
			||||||
        $attribs = array_map(function($v){
 | 
					        $attribs = array_map(function($v){
 | 
				
			||||||
            return Null;
 | 
					            return Null;
 | 
				
			||||||
        }, $this->fetchAttributes());
 | 
					        }, $this->getAttributes());
 | 
				
			||||||
        $obj->setValues($attribs);
 | 
					        $obj->setValues($attribs);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        $obj->fillDefaultValues();
 | 
					        $obj->fillDefaultValues();
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ defined('_JEXEC') or die;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class CommonClubsModelFactoryClub extends AbstractCommonClubsModelFactory
 | 
					class CommonClubsModelFactoryClub extends AbstractCommonClubsModelFactory
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public function getAttributes()
 | 
					    public function fetchAttributes()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return array(
 | 
					        return array(
 | 
				
			||||||
            'name'=>array(),
 | 
					            'name'=>array(),
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ defined('_JEXEC') or die;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class CommonClubsModelFactoryPlace extends AbstractCommonClubsModelFactory
 | 
					class CommonClubsModelFactoryPlace extends AbstractCommonClubsModelFactory
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public function getAttributes()
 | 
					    public function fetchAttributes()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return array(
 | 
					        return array(
 | 
				
			||||||
            'name'=>array(),
 | 
					            'name'=>array(),
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ defined('_JEXEC') or die;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class CommonClubsModelFactoryUser extends AbstractCommonClubsModelFactory
 | 
					class CommonClubsModelFactoryUser extends AbstractCommonClubsModelFactory
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public function getAttributes()
 | 
					    public function fetchAttributes()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return array(
 | 
					        return array(
 | 
				
			||||||
            'user'=>array(),
 | 
					            'user'=>array(),
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user