\BHB::$load->f()
We may load a (natural) Model in Controller
or load a Controller in Controller
or (app) Model in (natural or app) Model
or Model in layout gravif in /view/LayoutName/index.php.
We may load more than one time, but BHBSotf will make a check if this model
was loaded. Only if it is still not loaded will load it.
Examples:
First write this app in model.
<?php //create a file testobj.php in //module/greet/all/greet/model/testobj.php //and copy: namespace greet\model\testobj; class cloneobj { public $var; //*************************** public function f1($add=0) { $this->var = $this->var + $add; return $this->var; } }
after in a model or layout index.php file write to test by you:
<?php //the right syntax is: // $var = \BHB::$load->f('nameOfDirApp\Type[controller, model, ext, form, filter, ext2]', 'nameOfObjInBHBMemory'); // print $var->nameOfMethod($args); // or we may use \BHB::$obj: // print \BHB::obj('nameOfObjInBHBMemory')->nameOfMethod($args); // $var = \BHB::$load->f()->nameOfMethod($params); ?>
If you need to extend in Controller :
<?php //otherfile.php namespace greet\controller\otherfile; \BHB::$load->f('ext\mvc\controller\AbstractController'); use ext\mvc\controller\AbstractController\AbstractController as AbstractController; class otherfile extends AbstractController { } ?>
or for a Model:
<?php //otherfile.php namespace greet\controller\otherfile; \BHB::$load->f('ext\mvc\model\AbstractModel'); use ext\mvc\model\AbstractModel\AbstractModel AS AbstractModel; class otherfile extends AbstractController { } ?>
End.