本文整理汇总了PHP中Doctrine\Common\Persistence\ObjectRepository::findBySlug方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectRepository::findBySlug方法的具体用法?PHP ObjectRepository::findBySlug怎么用?PHP ObjectRepository::findBySlug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Common\Persistence\ObjectRepository
的用法示例。
在下文中一共展示了ObjectRepository::findBySlug方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listAction
/**
* @return \Zend\View\Model\ViewModel
*/
public function listAction()
{
$slug = $this->params('slug');
$page = $this->params('page');
$category = $this->categoryRepository->findBySlug($slug);
return new ViewModel(array('category' => $category, 'posts' => $this->postRepository->findByCategoryPaginated($category, $page)));
}
示例2: delete
/**
* @param $slug
*/
public function delete($slug)
{
$this->objectManager->remove($this->repository->findBySlug($slug));
$this->objectManager->flush();
}
示例3: viewAction
/**
* @return \Zend\View\Model\ViewModel
*/
public function viewAction()
{
$slug = $this->params('slug');
$post = $this->repository->findBySlug($slug);
return new ViewModel(array('post' => $post));
}
示例4: findBySlug
/**
* (non-PHPDoc)
* @see Rhapsody\SocialBundle\Doctrine\CategoryManagerInterface::findBySlug()
*/
public function findBySlug($slug)
{
return $this->repository->findBySlug($slug);
}