本文整理汇总了PHP中CategoryPeer::retrieveByName方法的典型用法代码示例。如果您正苦于以下问题:PHP CategoryPeer::retrieveByName方法的具体用法?PHP CategoryPeer::retrieveByName怎么用?PHP CategoryPeer::retrieveByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CategoryPeer
的用法示例。
在下文中一共展示了CategoryPeer::retrieveByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeView
public function executeView(sfWebRequest $request)
{
$category = CategoryPeer::retrieveByName($request->getParameter('category_name'));
$this->forward404Unless($category);
if ($category->getParentId() != 0) {
$this->parentCategory = CategoryPeer::retrieveByPk($category->getParentId());
} else {
$this->subCategorys = CategoryPeer::getAllSub($category->getId());
}
$c = new Criteria();
if (isset($this->subCategorys)) {
$subCategoryIds = array();
foreach ($this->subCategorys[$category->getId()] as $sub) {
$subCategoryIds[] = $sub->getId();
}
$subCategoryIds[] = $category->getId();
$c->add(ElementPeer::CATEGORY_ID, $subCategoryIds, Criteria::IN);
} else {
$c->add(ElementPeer::CATEGORY_ID, $category->getId());
}
$this->pager = new sfPropelPager('Element', 10);
$this->pager->setPeerMethod('doSelectJoinAll');
$this->pager->setCriteria($c);
$this->pager->setPage($this->getRequestParameter('page'), 1);
$this->pager->init();
$this->elements = $this->pager->getResults();
$this->category = $category;
}