Esempio n. 1
0
 public static function retrieveByPK($catalog_id, $department_id, $col_location_id, $col_status_id, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(VCatalogDetailPeer::CATALOG_ID, $catalog_id);
     $criteria->add(VCatalogDetailPeer::DEPARTMENT_ID, $department_id);
     $criteria->add(VCatalogDetailPeer::COL_LOCATION_ID, $col_location_id);
     $criteria->add(VCatalogDetailPeer::COL_STATUS_ID, $col_status_id);
     $v = VCatalogDetailPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
Esempio n. 2
0
 public function filterDetail($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'writer_id') {
             $c->addJoin(VCatalogDetailPeer::CATALOG_ID, CatalogPeer::ID);
             $c->addJoin(CatalogWriterPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogWriterPeer::getTableMap()->getColumn('WRITER_ID');
         } elseif ($key == 'code') {
             $c->addJoin(VCatalogDetailPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogPeer::getTableMap()->getColumn('CODE');
         } elseif ($key == 'title') {
             $c->addJoin(VCatalogDetailPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogPeer::getTableMap()->getColumn('TITLE');
         } elseif ($key == 'cat_category_id') {
             $c->addJoin(VCatalogDetailPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogPeer::getTableMap()->getColumn('CAT_CATEGORY_ID');
         } elseif ($key == 'publisher_id') {
             $c->addJoin(VCatalogDetailPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogPeer::getTableMap()->getColumn('PUBLISHER_ID');
         } elseif ($key == 'col_status_id') {
             $c->addJoin(VCatalogDetailPeer::COL_STATUS_ID, ColStatusPeer::ID);
             $column = ColStatusPeer::getTableMap()->getColumn('COL_STATUS_ID');
         } elseif ($key == 'department_id') {
             $c->addJoin(VCatalogDetailPeer::DEPARTMENT_ID, DepartmentPeer::ID);
             $column = DepartmentPeer::getTableMap()->getColumn('DEPARTMENT_ID');
         } else {
             $column = VCatalogDetailPeer::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);
                     }
                 }
             }
         }
     }
 }
Esempio n. 3
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = VCatalogDetailPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setCatalogId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setDepartmentId($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]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setColStatusId($arr[$keys[4]]);
     }
 }