コード例 #1
0
 /**
  * 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 you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by find*()
  * and findPk*() calls.
  *
  * @param \INSEEGeo\Model\InseeGeoRegionI18n $obj A \INSEEGeo\Model\InseeGeoRegionI18n 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 (null === $key) {
             $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
コード例 #2
0
ファイル: InseeGeoRegion.php プロジェクト: enurit/INSEEGeo
 /**
  * Method called to associate a ChildInseeGeoRegionI18n object to this object
  * through the ChildInseeGeoRegionI18n foreign key attribute.
  *
  * @param    ChildInseeGeoRegionI18n $l ChildInseeGeoRegionI18n
  * @return   \INSEEGeo\Model\InseeGeoRegion The current object (for fluent API support)
  */
 public function addInseeGeoRegionI18n(ChildInseeGeoRegionI18n $l)
 {
     if ($l && ($locale = $l->getLocale())) {
         $this->setLocale($locale);
         $this->currentTranslations[$locale] = $l;
     }
     if ($this->collInseeGeoRegionI18ns === null) {
         $this->initInseeGeoRegionI18ns();
         $this->collInseeGeoRegionI18nsPartial = true;
     }
     if (!in_array($l, $this->collInseeGeoRegionI18ns->getArrayCopy(), true)) {
         // only add it if the **same** object is not already associated
         $this->doAddInseeGeoRegionI18n($l);
     }
     return $this;
 }