<?php
namespace App\Zet\ContentBundle\Repository;
use App\Entity\StoreMap;
use App\Zet\ContentBundle\Entity\ContentBlock;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method ContentBlock|null find($id, $lockMode = null, $lockVersion = null)
* @method ContentBlock|null findOneBy(array $criteria, array $orderBy = null)
* @method ContentBlock[] findAll()
* @method ContentBlock[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ContentBlockRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ContentBlock::class);
}
public function finByCode($code){
return $this->createQueryBuilder('b')
->andWhere('b.code = :code')
->setParameter('code', $code)
->getQuery()
->getOneOrNullResult();
}
/**
* @param $entity ContentBlock
* @return mixed
*/
public function modify($entity){
return $entity->getBlockText();
}
// /**
// * @return Product[] Returns an array of Product objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('p')
->andWhere('p.exampleField = :val')
->setParameter('val', $value)
->orderBy('p.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?Product
{
return $this->createQueryBuilder('p')
->andWhere('p.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}