public static function retrieveByPK($catalog_id, $department_id, $cat_category_id, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $criteria = new Criteria(); $criteria->add(VOpacDigitalPeer::CATALOG_ID, $catalog_id); $criteria->add(VOpacDigitalPeer::DEPARTMENT_ID, $department_id); $criteria->add(VOpacDigitalPeer::CAT_CATEGORY_ID, $cat_category_id); $v = VOpacDigitalPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = VOpacDigitalPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setCatalogId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setTotalColItem($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setTitle($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setPublisherName($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setPublishedLocation($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setPublishedYear($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setWriterName($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setCatCategoryName($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setDepartmentName($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setColLocationName($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setDepartmentId($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setCatCategoryId($arr[$keys[11]]); } }
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); } } } } } }