Esempio n. 1
0
 /**
  * addModel 
  * 
  * @param bikes_Model_Abstract $model 
  * @access public
  * @return void
  */
 public function addModel(bikes_Model_Abstract $model)
 {
     if (empty($this->master)) {
         if ($model->hasCollection()) {
             $this->collections['master'] = $model->getCollection();
         }
         $this->master = $model;
     } else {
         if ($model->hasCollection()) {
             $this->collections['slave'] = $model->getCollection();
         }
         $this->slave = $model;
     }
 }
Esempio n. 2
0
 /**
  * Adds the related models to the mapper.
  * Relational mappers only take 2 related models.
  * 
  * @param bikes_Model_Abstract $model 
  * @access public
  * @return void
  */
 public function addModel(bikes_Model_Abstract $model)
 {
     if (empty($this->master)) {
         if ($model->hasCollection()) {
             $this->collections['master'] = $model->getCollection();
         }
         $this->master = $model;
     } elseif (empty($this->slave)) {
         if ($model->hasCollection()) {
             $this->collections['slave'] = $model->getCollection();
         }
         $this->slave = $model;
     } else {
         throw new bikes_CoreException(get_class($this) . ' can only take two related models.');
     }
 }