This topic contains 0 replies, has 1 voice, and was last updated by abaiedmadridi 5 years, 2 months ago.
-
Topic
-
hello, I try apply form OroEntityCreateOrSelect but I have error … idea is select or create new Object but I have error display two views ,view of select object existing and view of create object ..
this view display (two view display):code formType:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556<?phpnamespace Symdrik\CentralBundle\Form;use Symfony\Component\Form\AbstractType;use Symfony\Component\Form\FormBuilderInterface;use Symfony\Component\OptionsResolver\OptionsResolverInterface;use Symdrik\CentralBundle\Entity\Person;use Symfony\Component\OptionsResolver\OptionsResolver;class CreateOrSelectPersonType extends AbstractType{const TYPE_NAME = 'create_select_person_form';/*** {@inheritdoc}*/public function configureOptions(OptionsResolver $resolver){$resolver->setDefaults(array('grid_name'=> 'person-create-select-grid','create_entity_form_type' => PersonType::class,'class'=> Person::class,'view_widgets' => array(array('route_name' => 'symdrik_person_view'))));}/*** {@inheritdoc}*/public function getBlockPrefix(){return self::TYPE_NAME;}/*** {@inheritdoc}*/public function getName(){return $this->getBlockPrefix();}/*** {@inheritdoc}*/public function getParent(){return 'oro_entity_create_or_select';}}and this code child form :
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576<?phpnamespace Symdrik\CentralBundle\Form;use Symfony\Component\Form\AbstractType;use Symfony\Component\Form\FormBuilderInterface;use Symfony\Component\OptionsResolver\OptionsResolver;use Symfony\Component\OptionsResolver\OptionsResolverInterface;use Doctrine\Common\Persistence\ObjectManager;use Doctrine\ORM\EntityRepository;use Symdrik\CentralBundle\Utils\App;use Symfony\Component\Validator\Constraints\NotBlank;use Symdrik\CentralBundle\Entity\DistributionList;use Symdrik\CentralBundle\Form\FramedCollectionType;/***Class DistributionListType*/Class DistributionListType extends AbstractType{const TYPE_NAME = 'distribution_list_form';/*** {@inheritdoc}*/public function buildForm(FormBuilderInterface $builder, array $options){$builder->add('recipients', FramedCollectionType::class, ['show_form_when_empty' => false,'type' => 'create_select_person_form','allow_delete' => true,'handle_primary' => false,'options' => ['ownership_disabled' => true,],'required' => false,'prototype_name' => '__personDistribution__']);}/*** {@inheritdoc}*/public function getBlockPrefix(){return self::TYPE_NAME;}/*** {@inheritdoc}*/public function setDefaultOptions(OptionsResolverInterface $resolver){$resolver->setDefaults(array('data_class' => DistributionList::class));}/*** {@inheritdoc}*/public function getName(){return $this->getBlockPrefix();}}and this code view:
1234567891011121314151617{% set dataBlocks = [{'title': 'General'|trans,'subblocks': [{'data': [form_row(form.recipients),form_row(form.linkedContact),form_row(form.attachmentType)]}]}] %}{% set data = {'formErrors': form_errors(form)? form_errors(form) : null,'dataBlocks': dataBlocks,} %}{{ parent() }}how to resolve this error please
The forum ‘OroPlatform – Installation/Technical Issues or Problems’ is closed to new topics and replies.