/** * Form builder * * @param FormBuilderInterface $builder * @param array $options * * @return null */ public function buildForm(FormBuilderInterface $builder, array $options) { $this->bulletinInfoTitle = $options['bulletinInfoTitle']; if (null == $this->bulletinInfoTitle) { $builder->add('bulletinInfoTitle', EntityType::class, array('label' => 'BulletinInfoContent.bulletinInfoTitle.label', 'class' => 'AcfDataBundle:BulletinInfoTitle', 'query_builder' => function (BulletinInfoTitleRepository $btr) { return $btr->createQueryBuilder('bt')->orderBy('bt.title', 'ASC'); }, 'choice_label' => 'title', 'multiple' => false, 'by_reference' => true, 'required' => true)); } else { $btId = $this->bulletinInfoTitle->getId(); $builder->add('bulletinInfoTitle', EntityidType::class, array('label' => 'BulletinInfoContent.bulletinInfoTitle.label', 'class' => 'AcfDataBundle:BulletinInfoTitle', 'query_builder' => function (BulletinInfoTitleRepository $btr) use($btId) { return $btr->createQueryBuilder('bt')->where('bt.id = :id')->setParameter('id', $btId)->orderBy('bt.title', 'ASC'); }, 'choice_label' => 'id', 'multiple' => false, 'by_reference' => true, 'required' => true)); } $builder->add('title', TextType::class, array('label' => 'BulletinInfoContent.title.label')); $builder->add('content', TextareaType::class, array('label' => 'BulletinInfoContent.content.label', 'required' => false)); $builder->add('theme', TextType::class, array('label' => 'BulletinInfoContent.theme.label', 'required' => false)); $builder->add('jort', TextType::class, array('label' => 'BulletinInfoContent.jort.label', 'required' => false)); $builder->add('txtNum', TextType::class, array('label' => 'BulletinInfoContent.txtNum.label', 'required' => false)); $builder->add('artTxt', TextType::class, array('label' => 'BulletinInfoContent.artTxt.label', 'required' => false)); $builder->add('dtTxt', TextType::class, array('label' => 'BulletinInfoContent.dtTxt.label', 'required' => false)); $builder->add('artCode', TextType::class, array('label' => 'BulletinInfoContent.artCode.label', 'required' => false)); $builder->add('companyType', TextType::class, array('label' => 'BulletinInfoContent.companyType.label', 'required' => false)); $builder->add('dtApplication', TextType::class, array('label' => 'BulletinInfoContent.dtApplication.label', 'required' => false)); }
/** * Get Query for All Entities * * @param BulletinInfoTitle $bt * * @return \Doctrine\ORM\Query */ public function getAllByBulletinInfoTitleQuery(BulletinInfoTitle $bt) { $qb = $this->createQueryBuilder('bc')->join('bc.bulletinInfoTitle', 'bt')->join('bt.bulletinInfo', 'bi')->where('bt.id = :id')->orderBy('bc.dtCrea', 'ASC')->setParameter('id', $bt->getId()); $query = $qb->getQuery(); return $query; }