Username
Forgot password?
Welcome to our site!
Or Join with FTTF

Few doubts in Lampcms ???

2

773 views
Following method is actually in viewquestions.php

$tabs = Urhere::factory($this->Registry)->get('tplToptabs', $this->qtab);
$this->aPageVars['topTabs'] = $tabs;

return $this;

But factory method in User class,then how Viewquestions class calling User class method.

public static function factory(Registry $Registry, array $a = array()){
$o = new static($Registry, 'USERS', $a);

return $o;
}

The above factory method is in user class,the parameters also different from calling to called method,how it is possible?is it using default parameters concept???.and new static(parameters),to whom it is sending parameters???In calling class constructor is also not present.then how it is working???

Thanks Dmitri from James

 
asked December 3, 2011 at 4:06 AM

 IN

1 Answer

-1
 
The factory in Urhere is not in User class. Urhere class extends LampcmsObject, so it uses factory in LampcmsObject. That class in the \Lampcms\Object.php file.

factory method even though is static, is inherited by sub-class - it's part of php 5.3 late static binding feature, where a new keyword "static" refers to the calling class. factory method then call constructor of the calling class.

Trust me, everything just works, and works pretty well.

flag
answered December 3, 2011 at 5:35 AM

Your answer

Join with account you already have

FTTF

Preview

Alert