This topic contains 2 replies, has 2 voices, and was last updated by zhex900 6 years, 7 months ago.
- Topic
Hi
I have reported this problem in this post. Although it said the issue is resolved in OROCRM v. 2.3 but I still have the same issue.Here are the issues. I have made an extension relationship between CalendarEvent and my own entity EventName.
Create event through http://localhost/app_dev.php/calendar/default look like this. Basically, I replaced the title field with event name.
Issue 1. After the event is saved with the selected event name. Event title is not displayed. Title is displayed after page refresh.
Issue 2. After page refresh, when I edit the same event, evenname selection is blank. I need to reselect again.
To copy the value from EventName to Title, I have made a Event Subscriber. I add this Subscriber to the end of the builForm in CalendarEventApiTypeExtension.
1234public function buildForm(FormBuilderInterface $builder, array $options){$builder->addEventSubscriber(new CalendarEventApiTypeSubscriber($this->container));}1234567891011121314151617181920212223242526272829303132333435//CampusCalendarBundle/Form/EventListener/CalendarEventApiTypeSubscriber.phppublic static function getSubscribedEvents(){return [FormEvents::PRE_SUBMIT => 'preSubmitData',];}/*** @param FormEvent $event*/public function preSubmitData(FormEvent $event){$this->setTitle($event);}private function setTitle(FormEvent $event){$data = $event->getData();$eventname_id = $data['oro_eventname'];if ($eventname_id == null) {throw new \Exception('Please select an event name.');}/** @var EventName $event_name */$event_name = $this->container->get('doctrine')->getRepository('EventNameBundle:EventName')->find($eventname_id);$data['title'] = $event_name->getName();$event->setData($data);}
The forum ‘OroCRM’ is closed to new topics and replies.