Permalink
Browse files

Updated the TimingModel class to fix a compatibility warning in Mauti…

…c 2.7.1.
  • Loading branch information...
collinkrawll committed Apr 19, 2017
1 parent 3c7c3fe commit 8820ea88ad13153d0bf36798186e1194234846f8
Showing with 24 additions and 5 deletions.
  1. +1 −1 EventListener/TimingFormSubscriber.php
  2. +23 −4 Model/TimingModel.php
@@ -82,7 +82,7 @@ public function onPreSetData(FormEvent $formEvent)
//retrieve the campaign event timing from the db.
/* @var $timing \MauticPlugin\ThirdSetMauticTimingBundle\Entity\Timing */
$timing = $this->timingModel->getEntity($this->event);
$timing = $this->timingModel->getTimingForEvent($this->event);
//add the campaign event timing to the data.
$data['timing']['expression'] = $timing->getExpression();
View
@@ -38,15 +38,34 @@ public function getRepository()
{
return $this->em->getRepository('ThirdSetMauticTimingBundle:Timing');
}
/**
* Gets a Timing entity by its id or generates a new Timing entity if no id
* is passed.
*
* @param null|integer $id The id of the Timing entity.
*
* @return Entity Returns the Entity specified by $id or generates a new one
* if it doesn't yet exist.
*/
public function getEntity($id = null)
{
if ($id === null) {
return new Timing();
}
return parent::getEntity($id);
}
/**
* Get a specific entity or generate a new one doesn't yet exist.
* Get a specific Timing entity or generate a new one if it doesn't yet
* exist.
*
* @param $event Event
* @param $event Event The event that the Timing is for.
*
* @return null|Timing
* @return null|Timing Returns the Timing for the passed Event.
*/
public function getEntity(Event $event = null)
public function getTimingForEvent(Event $event = null)
{
if ($event === null) {
return new Timing($event);

0 comments on commit 8820ea8

Please sign in to comment.