Ejemplo n.º 1
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = VCatalogPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setCatalogId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setCopies($arr[$keys[1]]);
     }
 }
Ejemplo n.º 2
0
 public function filter($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(CatalogWriterPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogWriterPeer::getTableMap()->getColumn('WRITER_ID');
         } elseif ($key == 'copies') {
             $c->addJoin(VCatalogPeer::CATALOG_ID, CatalogPeer::ID);
             $column = VCatalogPeer::getTableMap()->getColumn('COPIES');
         } elseif ($key == 'writer') {
             $c->addJoin(CatalogWriterPeer::CATALOG_ID, CatalogPeer::ID);
             $c->addJoin(WriterPeer::ID, CatalogWriterPeer::WRITER_ID);
             $column = WriterPeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'publisher') {
             $c->addJoin(PublisherPeer::ID, CatalogPeer::PUBLISHER_ID);
             $column = PublisherPeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'title') {
             $column = CatalogPeer::getTableMap()->getColumn('TITLE');
         } else {
             $column = CatalogPeer::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);
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 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(VCatalogPeer::CATALOG_ID, $pks, Criteria::IN);
         $objs = VCatalogPeer::doSelect($criteria, $con);
     }
     return $objs;
 }