Пример #1
0
 /**
  * @param FeatureModel $feature
  * @depends testUpdate
  */
 public function testDelete(FeatureModel $feature)
 {
     $event = new FeatureDeleteEvent($feature->getId());
     $action = new Feature();
     $action->delete($event, null, $this->getMockEventDispatcher());
     $deletedFeature = $event->getFeature();
     $this->assertInstanceOf('Thelia\\Model\\Feature', $deletedFeature);
     $this->assertTrue($deletedFeature->isDeleted());
 }
Пример #2
0
 /**
  * Create a new feature entry
  *
  * @param \Thelia\Core\Event\Feature\FeatureCreateEvent $event
  * @param $eventName
  * @param EventDispatcherInterface $dispatcher
  */
 public function create(FeatureCreateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
 {
     $feature = new FeatureModel();
     $feature->setDispatcher($dispatcher)->setLocale($event->getLocale())->setTitle($event->getTitle())->save();
     $event->setFeature($feature);
     // Add atribute to all product templates if required
     if ($event->getAddToAllTemplates() != 0) {
         $this->doAddToAllTemplates($feature);
     }
 }
Пример #3
0
 /**
  * Filter the query by a related \Thelia\Model\Feature object
  *
  * @param \Thelia\Model\Feature|ObjectCollection $feature The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildFeatureProductQuery The current query, for fluid interface
  */
 public function filterByFeature($feature, $comparison = null)
 {
     if ($feature instanceof \Thelia\Model\Feature) {
         return $this->addUsingAlias(FeatureProductTableMap::FEATURE_ID, $feature->getId(), $comparison);
     } elseif ($feature instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(FeatureProductTableMap::FEATURE_ID, $feature->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByFeature() only accepts arguments of type \\Thelia\\Model\\Feature or Collection');
     }
 }
Пример #4
0
 /**
  * @param Feature $object
  * @return int
  */
 protected function getObjectId($object)
 {
     return $object->getId();
 }
Пример #5
0
 /**
  * Declares an association between this object and a ChildFeature object.
  *
  * @param                  ChildFeature $v
  * @return                 \Thelia\Model\FeatureTemplate The current object (for fluent API support)
  * @throws PropelException
  */
 public function setFeature(ChildFeature $v = null)
 {
     if ($v === null) {
         $this->setFeatureId(NULL);
     } else {
         $this->setFeatureId($v->getId());
     }
     $this->aFeature = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildFeature object, it will not be re-added.
     if ($v !== null) {
         $v->addFeatureTemplate($this);
     }
     return $this;
 }
Пример #6
0
 /**
  * Exclude object from result
  *
  * @param   ChildFeature $feature Object to remove from the list of results
  *
  * @return ChildFeatureQuery The current query, for fluid interface
  */
 public function prune($feature = null)
 {
     if ($feature) {
         $this->addUsingAlias(FeatureTableMap::ID, $feature->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }