public function testGetPostage() { $country = new Country(); $area = new Area(); $instance = new FlatFeeDelivery(); $area->setPostage(2.0); $country->setArea($area); $this->assertEquals($instance->getPostage($country), 2.0); $area->setPostage(null); $country->setArea($area); $this->assertEquals($instance->getPostage($country), 0.0); }
/** * Returns the object ID from the object * * @param \Thelia\Model\Area $object * @return int */ protected function getObjectId($object) { return $object->getId(); }
/** * Filter the query by a related \Thelia\Model\Area object * * @param \Thelia\Model\Area|ObjectCollection $area The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface */ public function filterByArea($area, $comparison = null) { if ($area instanceof \Thelia\Model\Area) { return $this->addUsingAlias(AreaDeliveryModuleTableMap::AREA_ID, $area->getId(), $comparison); } elseif ($area instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(AreaDeliveryModuleTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByArea() only accepts arguments of type \\Thelia\\Model\\Area or Collection'); } }
/** * @depends testRemoveCountry */ public function testDelete(AreaModel $area) { $event = new AreaDeleteEvent($area->getId()); $event->setDispatcher($this->getMock("Symfony\\Component\\EventDispatcher\\EventDispatcherInterface")); $areaAction = new Area(); $areaAction->delete($event); $deletedArea = $event->getArea(); $this->assertInstanceOf('Thelia\\Model\\Area', $deletedArea); $this->assertTrue($deletedArea->isDeleted()); }
/** * @param AreaModel $area * @depends testRemoveCountry */ public function testDelete(AreaModel $area) { $event = new AreaDeleteEvent($area->getId()); $areaAction = new Area(); $areaAction->delete($event, null, $this->getMockEventDispatcher()); $deletedArea = $event->getArea(); $this->assertInstanceOf('Thelia\\Model\\Area', $deletedArea); $this->assertTrue($deletedArea->isDeleted()); }
public function create(AreaCreateEvent $event) { $area = new AreaModel(); $area->setDispatcher($event->getDispatcher())->setName($event->getAreaName())->save(); $event->setArea($area); }
/** * Declares an association between this object and a ChildArea object. * * @param ChildArea $v * @return \Thelia\Model\CountryArea The current object (for fluent API support) * @throws PropelException */ public function setArea(ChildArea $v = null) { if ($v === null) { $this->setAreaId(NULL); } else { $this->setAreaId($v->getId()); } $this->aArea = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the ChildArea object, it will not be re-added. if ($v !== null) { $v->addCountryArea($this); } return $this; }
/** * Exclude object from result * * @param ChildArea $area Object to remove from the list of results * * @return ChildAreaQuery The current query, for fluid interface */ public function prune($area = null) { if ($area) { $this->addUsingAlias(AreaTableMap::ID, $area->getId(), Criteria::NOT_EQUAL); } return $this; }
public function create(AreaCreateEvent $event, $eventName, EventDispatcherInterface $dispatcher) { $area = new AreaModel(); $area->setDispatcher($dispatcher)->setName($event->getAreaName())->save(); $event->setArea($area); }