Ejemplo n.º 1
0
 protected function getUpdateEvent($formData)
 {
     $changeEvent = new FeatureAvUpdateEvent($formData['id']);
     // Create and dispatch the change event
     $changeEvent->setLocale($formData["locale"])->setTitle($formData['title'])->setChapo($formData['chapo'])->setDescription($formData['description'])->setPostscriptum($formData['postscriptum']);
     return $changeEvent;
 }
Ejemplo n.º 2
0
 /**
  * Process the features values (fix it in future version to integrate it in the feature form as a collection)
  *
  * @see \Thelia\Controller\Admin\AbstractCrudController::performAdditionalUpdateAction()
  */
 protected function performAdditionalUpdateAction($updateEvent)
 {
     $attr_values = $this->getRequest()->get('feature_values', null);
     if ($attr_values !== null) {
         foreach ($attr_values as $id => $value) {
             $event = new FeatureAvUpdateEvent($id);
             $event->setTitle($value);
             $event->setLocale($this->getCurrentEditionLocale());
             $this->dispatch(TheliaEvents::FEATURE_AV_UPDATE, $event);
         }
     }
     return null;
 }
Ejemplo n.º 3
0
 /**
  * @param FeatureAvModel $featureAv
  * @depends testCreate
  */
 public function testUpdate(FeatureAvModel $featureAv)
 {
     $event = new FeatureAvUpdateEvent($featureAv->getId());
     $event->setLocale('en_uS')->setTitle('test update')->setDescription('test description')->setChapo('test chapo')->setPostscriptum('test postscriptum')->setDispatcher($this->dispatcher);
     $action = new FeatureAv();
     $action->update($event);
     $updatedFeatureAv = $event->getFeatureAv();
     $this->assertInstanceOf('Thelia\\Model\\FeatureAv', $updatedFeatureAv);
     $this->assertEquals('en_US', $updatedFeatureAv->getLocale());
     $this->assertEquals('test update', $updatedFeatureAv->getTitle());
     $this->assertEquals('test chapo', $updatedFeatureAv->getChapo());
     $this->assertEquals('test description', $updatedFeatureAv->getDescription());
     $this->assertEquals('test postscriptum', $updatedFeatureAv->getPostscriptum());
     return $updatedFeatureAv;
 }