Answer the question
In order to leave comments, you need to log in
How to use your repositories in BuildForm?
Good afternoon. How to use your repositories in this case:
Repository:
<?php
namespace ParserBundle\Repository;
use Doctrine\ORM\EntityRepository;
class CrbrItemMakerRepository extends EntityRepository
{
public function findAllQuery()
{
return $this
->createQueryBuilder('m')
->orderBy('m.name', 'ASC')
->getQuery()
->useResultCache(true, 60*60*24, 'category_cache');
}
}
use ParserBundle\Repository\CrbrItemMakerRepository;
......
$builder
->add(
'maker',
'entity',
array(
'class' => 'ParserBundle:CrbrItemMaker',
'property' => 'name',
'required' => false,
'data' => $maker,
'empty_value' => '-- Все --',
'query_builder' => function(CrbrItemMakerRepository $er ) use ( $options ) {
return $er->findAllQuery();
}
)
)
Answer the question
In order to leave comments, you need to log in
For the ParserBundle:CrbrItemMaker entity, you need to specify the repository : doctrine-orm.readthedocs.org/en/latest/reference/w...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question