Exemple #1
0
 /**
  * Retrieves subanswer object if defined
  *
  * @return	RM_Anketa_Entity_Subanswer
  **/
 public function getSubanswer()
 {
     /*		if (!$this->subanswer_id)
     			return NULL;*/
     if (is_null($this->_subanswer)) {
         $this->_subanswer = $this->_mapper->loadById('subanswer', $this->subanswer_id);
     }
     return $this->_subanswer;
 }
Exemple #2
0
 /**
  * Retrieves parent object
  *
  * @return	RM_Anketa_Entity
  **/
 protected function _getParent()
 {
     $parent_type = @$this->_mapper->parent_type($this->type());
     if (!$parent_type) {
         return NULL;
     }
     if (is_null($this->_parent)) {
         $this->_parent = $this->_mapper->loadById($parent_type, $this->{$parent_type . '_id'});
     }
     return $this->_parent;
 }
Exemple #3
0
 /**
  * Executes load<Entity>ById & get<Entity>List & create<Entity> methods
  **/
 public function __call($method, $args)
 {
     if (preg_match('/load(\\w+)ById/', $method, $match)) {
         return $this->_mapper->loadById(strtolower($match[1]), $args[0]);
     } else {
         if (preg_match('/get(\\w+)List/', $method, $match)) {
             return $this->_mapper->getList(strtolower($match[1]));
         } else {
             if (preg_match('/create(\\w+)/', $method, $match)) {
                 return $this->_mapper->createEntity(strtolower($match[1]), $args[0], @$args[1]);
             } else {
                 if (isset($this->_extension[strtolower($method)])) {
                     $extension = strtolower($method);
                     if (!is_object($this->_extension[$extension])) {
                         $extension_class = 'RM_Anketa_Extension_' . ucfirst($extension);
                         $this->_extension[$extension] = new $extension_class($this->_mapper);
                     }
                     return $this->_extension[$extension];
                 } else {
                     throw new Exception("Unknown method `{$method}'");
                 }
             }
         }
     }
 }
Exemple #4
0
 /**
  * @see	RM_Anketa_Mapper::getResultAnswers() // список ответов
  **/
 public function getResultAnswers(RM_Anketa_Entity_Question $obQuestion = NULL)
 {
     return $this->_mapper->getResultAnswers($this, $obQuestion);
 }