Пример #1
0
 /**
  * @return SimDAL_Query
  */
 protected function _getQuery()
 {
     if (is_null($this->_query)) {
         $this->_query = new SimDAL_Query($this, SimDAL_Query::TYPE_SELECT, $this->_getSession()->getMapper());
         $this->_query->from($this->_getSession()->getMapper()->getMappingForEntityClass($this->_getAssociation()->getClass()));
         $parentKey = $this->_getAssociation()->getParentKey();
         $parentKey_getter = 'get' . $parentKey;
         $value = $this->_getParent()->{$parentKey_getter}();
         if (is_null($value)) {
             $this->_query = null;
             return false;
         }
         $this->_query->whereColumn($this->_getAssociation()->getForeignKey())->equals($value);
     }
     return $this->_query;
 }