25 lines
593 B
PHP
25 lines
593 B
PHP
<?php
|
|
|
|
namespace AppBundle\Entity;
|
|
|
|
/**
|
|
* CMSContentRepository
|
|
*
|
|
* This class was generated by the Doctrine ORM. Add your own custom
|
|
* repository methods below.
|
|
*/
|
|
class CMSContentRepository extends \Doctrine\ORM\EntityRepository
|
|
{
|
|
|
|
public function findBySlug($slug)
|
|
{
|
|
$qb = $this->getEntityManager()->createQueryBuilder();
|
|
$qb->select('c');
|
|
$qb->from('AppBundle:CMSContent', 'c');
|
|
$qb->where('c.slug = :slug');
|
|
$qb->setParameter('slug', $slug);
|
|
$qb->setMaxResults(1);
|
|
return $qb->getQuery()->getOneOrNullResult();
|
|
|
|
}
|
|
}
|