public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(VMaterialCollectionPeer::CAT_CATEGORY_ID, $pks, Criteria::IN);
         $objs = VMaterialCollectionPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = VMaterialCollectionPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setCatCategoryId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setPublishedYear($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setTotalColItem($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setColLocationId($arr[$keys[3]]);
     }
 }
示例#3
0
 public function filterMaterial($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'TOTAL_CATALOG') {
             $c->add(VMaterialCatalogPeer::CAT_CATEGORY_ID, VMaterialCollectionPeer::CAT_CATEGORY_ID);
             #$c->add(VMaterialCatalogPeer::PUBLISHED_YEAR, VMaterialCollectionPeer::PUBLISHED_YEAR);
             $column = VMaterialCatalogPeer::getTableMap()->getColumn('TOTAL_CATALOG');
         } else {
             $column = VMaterialCollectionPeer::getTableMap()->getColumn($key);
         }
         $name = $column->getFullyQualifiedName();
         $creoleType = $column->getCreoleType();
         if ($creoleType == CreoleTypes::TIMESTAMP) {
             $from = $value['from'];
             $to = $value['to'];
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
             }
             if ($to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } else {
             if ($creoleType == CreoleTypes::INTEGER || $creoleType == CreoleTypes::BIGINT) {
                 $c->add($name, $value, Criteria::EQUAL);
             } else {
                 if ($creoleType == CreoleTypes::VARCHAR) {
                     $c->add($name, "%{$value}%", Criteria::LIKE);
                 } else {
                     if ($creoleType == CreoleTypes::NUMERIC) {
                         $c->add($name, $value, Criteria::EQUAL);
                     }
                 }
             }
         }
     }
 }