src/Zet/ContentBundle/Repository/ContentBlockRepository.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Zet\ContentBundle\Repository;
  3. use App\Entity\StoreMap;
  4. use App\Zet\ContentBundle\Entity\ContentBlock;
  5. use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
  6. use Doctrine\Persistence\ManagerRegistry;
  7. /**
  8.  * @method ContentBlock|null find($id, $lockMode = null, $lockVersion = null)
  9.  * @method ContentBlock|null findOneBy(array $criteria, array $orderBy = null)
  10.  * @method ContentBlock[]    findAll()
  11.  * @method ContentBlock[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  12.  */
  13. class ContentBlockRepository extends ServiceEntityRepository
  14. {
  15.     public function __construct(ManagerRegistry $registry)
  16.     {
  17.         parent::__construct($registryContentBlock::class);
  18.     }
  19.     public function finByCode($code){
  20.         return $this->createQueryBuilder('b')
  21.             ->andWhere('b.code = :code')
  22.             ->setParameter('code'$code)
  23.             ->getQuery()
  24.             ->getOneOrNullResult();
  25.     }
  26.     /**
  27.      * @param $entity ContentBlock
  28.      * @return mixed
  29.      */
  30.     public function modify($entity){
  31.         return $entity->getBlockText();
  32.     }
  33.     // /**
  34.     //  * @return Product[] Returns an array of Product objects
  35.     //  */
  36.     /*
  37.     public function findByExampleField($value)
  38.     {
  39.         return $this->createQueryBuilder('p')
  40.             ->andWhere('p.exampleField = :val')
  41.             ->setParameter('val', $value)
  42.             ->orderBy('p.id', 'ASC')
  43.             ->setMaxResults(10)
  44.             ->getQuery()
  45.             ->getResult()
  46.         ;
  47.     }
  48.     */
  49.     /*
  50.     public function findOneBySomeField($value): ?Product
  51.     {
  52.         return $this->createQueryBuilder('p')
  53.             ->andWhere('p.exampleField = :val')
  54.             ->setParameter('val', $value)
  55.             ->getQuery()
  56.             ->getOneOrNullResult()
  57.         ;
  58.     }
  59.     */
  60. }