Пример #1
0
 public function __construct($model = null)
 {
     parent::__construct();
     $this->data = new stdClass();
     $this->meta = new ControllerMeta();
     /*{ TODO Having an XDO should be optional not all app asks for an XDO*/
     if (!$this instanceof NoXDO) {
         $this->xdo = new ControllerXDO();
         if ($this->xdo->serialized()) {
             $this->xdo->unserialize();
         }
     } else {
         $this->xdo = new DummyXDO();
     }
     /*}*/
     /*{ TODO Save applies here too. not all app need a session Storage some wants to work real Stateless too*/
     if (!$this instanceof NoSession) {
         $this->session = new SessionXDO();
         if ($this->session->serialized()) {
             $this->session->unserialize();
         }
     } else {
         $this->session = new DummyXDO();
     }
     /**/
     $controllerName = get_class($this);
     if (!$this instanceof NoXDO) {
         $desc = new \ROM\BongXDODescriptor(\ROM\BongXDODescriptor::ControllerXDO, $controllerName, $this->xdo->sessionFilePath());
         \ROM\BongCurrentUserData::instance()->addXDO($desc);
     }
     $this->spiritEngine = EngineFactory::produce("SpiritEngine", array(&$this));
     $this->ctor();
 }
Пример #2
0
 public function __construct(&$engine, $spiritName, $instanceId = null)
 {
     if (!static::iCheck()) {
         assert("/*Some Interface Not Implemented Properly Check Previous Errors*/");
         return false;
     }
     parent::__construct();
     $this->data = new stdClass();
     $this->_engine = $engine;
     $this->meta = new SpiritMeta($spiritName);
     if (static::serializable() == SpiritAbstractor::SerializableXDO) {
         $this->xdo = new SpiritXDO();
     } else {
         $this->xdo = new SpiritMemoryXDO();
         //TODO should be new MemoryXDO() Instead.
     }
     $this->xdo->setAbstractor($this);
     $this->xdo->setSpirit($spiritName);
     if (static::serializable() == SpiritAbstractor::SerializableXDO) {
         $_spiritName = get_class($this);
         $desc = new \ROM\BongXDODescriptor(\ROM\BongXDODescriptor::SpiritXDO, $_spiritName, $this->xdo->sessionFilePath());
         \ROM\BongCurrentUserData::instance()->addXDO($desc);
     }
     if (static::feeder() == SpiritAbstractor::ControllerFeeded) {
         $this->controller = $engine->currentController();
     } elseif (static::feeder() == SpiritAbstractor::SpiritFeeded) {
         $this->controller = $engine->abstractor();
     }
     /*} */
     if (static::binding() == SpiritAbstractor::InstanceBinding) {
         $this->_instanceId = $instanceId;
         $this->xdo->setUID($this->uid());
     }
     if ($this->xdo->serialized()) {
         $this->xdo->unserialize();
     }
     $this->xdo->setSpirit($spiritName);
     $this->ctor();
 }