/** * Checks and repairs the internal consistency of the object. * * This method is executed after an already-instantiated object is re-hydrated * from the database. It exists to check any foreign keys to make sure that * the objects related to the current object are correct based on foreign key. * * You can override this method in the stub class, but you should always invoke * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * * @throws PropelException */ public function ensureConsistency() { if ($this->aCountry !== null && $this->default_country_id !== $this->aCountry->getId()) { $this->aCountry = null; } if ($this->aCurrency !== null && $this->default_currency_id !== $this->aCurrency->getId()) { $this->aCurrency = null; } }
/** * * @return multitype:Country creates an array of all the data a country has. */ public static function getCountries() { $countries = array(); $country = new Country(); $country->setId(1); $country->setName('America'); $countries[$country->getId()] = $country; $country2 = new Country(); $country2->setId(2); $country2->setname('Germany'); $countries[$country2->getId()] = $country2; return $countries; }
/** * Exclude object from result * * @param Country $country Object to remove from the list of results * * @return CountryQuery The current query, for fluid interface */ public function prune($country = null) { if ($country) { $this->addUsingAlias(CountryPeer::ID, $country->getId(), Criteria::NOT_EQUAL); } return $this; }
/** * Checks and repairs the internal consistency of the object. * * This method is executed after an already-instantiated object is re-hydrated * from the database. It exists to check any foreign keys to make sure that * the objects related to the current object are correct based on foreign key. * * You can override this method in the stub class, but you should always invoke * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * * @throws PropelException */ public function ensureConsistency() { if ($this->aCustomerTitle !== null && $this->title_id !== $this->aCustomerTitle->getId()) { $this->aCustomerTitle = null; } if ($this->aCountry !== null && $this->country_id !== $this->aCountry->getId()) { $this->aCountry = null; } }
public function testGetSetId() { $this->country->setId('GBR'); $this->assertEquals('GBR', $this->country->getId()); }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Country $obj A Country object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool($obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
protected function assertPreConditions() { $this->assertInstanceOf('JLM\\DailyBundle\\Model\\PartFamilyInterface', $this->entity); $this->assertNull($this->entity->getId()); $this->assertNull($this->entity->getName()); }
/** * Declares an association between this object and a Country object. * * @param Country $v * @return State The current object (for fluent API support) * @throws PropelException */ public function setCountry(Country $v = null) { if ($v === null) { $this->setCountryId(NULL); } else { $this->setCountryId($v->getId()); } $this->aCountry = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Country object, it will not be re-added. if ($v !== null) { $v->addState($this); } return $this; }
/** * {@inheritdoc} */ protected function assertPreConditions() { $this->assertInstanceOf('JLM\\ContractBundle\\Model\\ContractInterface', $this->entity); $this->assertNull($this->entity->getId()); }
/** * Checks and repairs the internal consistency of the object. * * This method is executed after an already-instantiated object is re-hydrated * from the database. It exists to check any foreign keys to make sure that * the objects related to the current object are correct based on foreign key. * * You can override this method in the stub class, but you should always invoke * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * * @throws PropelException */ public function ensureConsistency() { if ($this->aCountry !== null && $this->country_id !== $this->aCountry->getId()) { $this->aCountry = null; } }