sterntours/src/AppBundle/Entity/CMSContentRepository.php
2020-07-09 12:49:32 +02:00

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();
}
}