public static function getPhpNameMap() { if (self::$phpNameMap === null) { $map = CatCategoryPeer::getTableMap(); $columns = $map->getColumns(); $nameMap = array(); foreach ($columns as $column) { $nameMap[$column->getPhpName()] = $column->getColumnName(); } self::$phpNameMap = $nameMap; } return self::$phpNameMap; }
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 == 'SIGN_CODE') { $c->addJoin(CatalogPeer::ID, ColItemPeer::CATALOG_ID); $column = CatalogPeer::getTableMap()->getColumn('CODE'); } elseif ($key == 'CODE') { $c->addJoin(ColLocationPeer::ID, ColItemPeer::COL_LOCATION_ID); $column = ColLocationPeer::getTableMap()->getColumn('CODE'); } elseif ($key == 'TITLE') { $c->addJoin(CatalogPeer::ID, ColItemPeer::CATALOG_ID); $column = CatalogPeer::getTableMap()->getColumn('TITLE'); } elseif ($key == 'PUBLISHER_NAME') { $c->addJoin(CatalogPeer::ID, ColItemPeer::CATALOG_ID); $c->addJoin(PublisherPeer::ID, CatalogPeer::PUBLISHER_ID); $column = PublisherPeer::getTableMap()->getColumn('NAME'); } elseif ($key == 'WRITER_NAME') { $c->addJoin(CatalogPeer::ID, ColItemPeer::CATALOG_ID); $c->addJoin(CatalogWriterPeer::CATALOG_ID, CatalogPeer::ID); $c->addJoin(WriterPeer::ID, CatalogWriterPeer::WRITER_ID); $column = WriterPeer::getTableMap()->getColumn('NAME'); } elseif ($key == 'CAT_CATEGORY_ID') { $c->addJoin(CatalogPeer::ID, ColItemPeer::CATALOG_ID); $c->addJoin(CatCategoryPeer::ID, CatalogPeer::CAT_CATEGORY_ID); $column = CatCategoryPeer::getTableMap()->getColumn('ID'); } else { $column = ColItemPeer::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); } } } } }
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_name') { $column = VOpacDigitalPeer::getTableMap()->getColumn('WRITER_NAME'); } elseif ($key == 'department_id') { if ($filters[$key] == 1) { $c->addJoin(VOpacDigitalPeer::CATALOG_ID, CatalogPeer::ID); $c->addJoin(DepartmentPeer::ID, VOpacDigitalPeer::DEPARTMENT_ID); $column = DepartmentPeer::getTableMap()->getColumn('ID'); } else { $c->addJoin(VOpacDigitalPeer::CATALOG_ID, CatalogPeer::ID); $c->addJoin(DepartmentPeer::ID, VOpacDigitalPeer::DEPARTMENT_ID); $c->addJoin(VDepartmentPeer::ID, DepartmentPeer::PARENT); $column = VDepartmentPeer::getTableMap()->getColumn('ID'); } } elseif ($key == 'cat_category_id') { $c->addJoin(VOpacDigitalPeer::CATALOG_ID, CatalogPeer::ID); $c->addJoin(CatCategoryPeer::ID, VOpacDigitalPeer::CAT_CATEGORY_ID); $column = CatCategoryPeer::getTableMap()->getColumn('ID'); } elseif ($key == 'publisher_name') { $column = VOpacDigitalPeer::getTableMap()->getColumn('PUBLISHER_NAME'); } elseif ($key == 'title') { $column = VOpacDigitalPeer::getTableMap()->getColumn('TITLE'); } elseif ($key == 'keyword') { $c->addJoin(CatalogPeer::ID, VOpacDigitalPeer::CATALOG_ID); $column = CatalogPeer::getTableMap()->getColumn('SEARCH_KEYWORDS'); } elseif ($key == 'synopsis') { $c->addJoin(CatalogPeer::ID, VOpacDigitalPeer::CATALOG_ID); $column = CatalogPeer::getTableMap()->getColumn('SYNOPSIS'); } elseif ($key == 'published_location') { $column = VOpacDigitalPeer::getTableMap()->getColumn('PUBLISHED_LOCATION'); } elseif ($key == 'published_year') { $column = VOpacDigitalPeer::getTableMap()->getColumn('PUBLISHED_YEAR'); } $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); } } } } } }
public function filter($c, $filters) { $filters_key = array_keys($filters); foreach ($filters_key as $key) { $value = $filters[$key]; if ($value == '' || $value == null) { continue; } $column = CatCategoryPeer::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) { $c->add($name, $value, Criteria::EQUAL); } else { if ($creoleType == CreoleTypes::VARCHAR || $creoleType == CreoleTypes::CHAR) { $c->add($name, "%{$value}%", Criteria::LIKE); } } } } }