Example #1
0
 /**
  * @param StateModel $state
  * @depends testCreate
  * @return StateModel
  */
 public function testUpdate(StateModel $state)
 {
     $event = new StateUpdateEvent($state->getId());
     $event->setIsocode('BB')->setVisible(0)->setCountry($state->getCountryId())->setLocale('en_US')->setTitle('State2');
     $action = new State();
     $action->update($event);
     $updatedState = $event->getState();
     $this->assertInstanceOf('Thelia\\Model\\State', $updatedState);
     $this->assertEquals('BB', $updatedState->getIsocode());
     $this->assertEquals(0, $updatedState->getVisible());
     $this->assertEquals('en_US', $updatedState->getLocale());
     $this->assertEquals('State2', $updatedState->getTitle());
     return $updatedState;
 }
Example #2
0
 /**
  * Filter the query by a related \Thelia\Model\State object
  *
  * @param \Thelia\Model\State|ObjectCollection $state  the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildCountryQuery The current query, for fluid interface
  */
 public function filterByState($state, $comparison = null)
 {
     if ($state instanceof \Thelia\Model\State) {
         return $this->addUsingAlias(CountryTableMap::ID, $state->getCountryId(), $comparison);
     } elseif ($state instanceof ObjectCollection) {
         return $this->useStateQuery()->filterByPrimaryKeys($state->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByState() only accepts arguments of type \\Thelia\\Model\\State or Collection');
     }
 }
Example #3
0
 /**
  * Hydrate the update form for this object, before passing it to the update template
  *
  * @param \Thelia\Model\State $object
  */
 protected function hydrateObjectForm($object)
 {
     $data = array('id' => $object->getId(), 'locale' => $object->getLocale(), 'visible' => $object->getVisible() ? true : false, 'country_id' => $object->getCountryId(), 'title' => $object->getTitle(), 'isocode' => $object->getIsocode());
     return $this->createForm(AdminForm::STATE_MODIFICATION, 'form', $data);
 }