Пример #1
0
 public static function getPhpNameMap()
 {
     if (self::$phpNameMap === null) {
         $map = VCatalogDetailPeer::getTableMap();
         $columns = $map->getColumns();
         $nameMap = array();
         foreach ($columns as $column) {
             $nameMap[$column->getPhpName()] = $column->getColumnName();
         }
         self::$phpNameMap = $nameMap;
     }
     return self::$phpNameMap;
 }
Пример #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);
                     }
                 }
             }
         }
     }
 }