Example #1
0
 public function initialize()
 {
     if (!$this->isInitialized()) {
         $table = $this->field->getTable();
         $id = $table->getPropertyValue($this->owner, $table->getPrimaryKeyField());
         $this->dao->__refreshByFK($this->delegate, $id, $this->field->getForeignKeyConstraint());
         ProxyUtils::swap($this->owner, $this->delegate, $this->field, $this->dao);
     }
 }
 public function initialize()
 {
     if (!$this->isInitialized() && !$this->initializing) {
         $this->initializing = true;
         $this->dao->setCache($this->owner);
         $table = $this->field->getTable();
         $id = $table->getPropertyValue($this->owner, $table->getPrimaryKeyField());
         $this->collection = array();
         ProxyUtils::swap($this->owner, $this->collection, $this->field, $this->dao);
         $this->dao->__refreshByFK($this->collection, $id, $this->field->getForeignKeyConstraint());
         $cacheCopy = $this->getArrayCopy();
         ProxyUtils::swap($this->owner->{Dao::CACHE}, $cacheCopy, $this->field, $this->dao);
         $this->initialized = true;
         $this->initializing = false;
     }
 }