示例#1
0
 public static function find($select = '*', $where = '', $orderBy = '')
 {
     $className = get_called_class();
     $classMap = PersistentManager::getInstance()->getClassMap($className);
     $criteria = new RetrieveCriteria($classMap);
     $criteria->select($select)->where($where)->orderBy($orderBy);
     return $criteria;
 }
示例#2
0
 public function getCriteria($orderAttrs)
 {
     $criteria = new RetrieveCriteria($this->toClassMap);
     if ($this->cardinality == 'manyToMany') {
         $criteria->addAssociationCriteria($this->fromClassName . $this->name, $this);
         $criteria->addCriteria($this->fromAttributeMap, '=', '?');
     } else {
         $criteria->addCriteria($this->toAttributeMap, '=', '?');
     }
     if (count($this->orderAttributes)) {
         foreach ($this->orderAttributes as $order) {
             $criteria->orderBy($order);
         }
     }
     return $criteria;
 }