Example #1
0
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this LanguageScript is new, it will return
  * an empty collection; or if this LanguageScript has previously
  * been saved, it will retrieve related Localizations from storage.
  *
  * This method is protected by default in order to keep the public
  * api reasonable.  You can provide public methods for those you
  * actually need in LanguageScript.
  *
  * @param      Criteria $criteria optional Criteria object to narrow the query
  * @param      ConnectionInterface $con optional connection object
  * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
  * @return ObjectCollection|ChildLocalization[] List of ChildLocalization objects
  */
 public function getLocalizationsJoinExtLang(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
 {
     $query = ChildLocalizationQuery::create(null, $criteria);
     $query->joinWith('ExtLang', $joinBehavior);
     return $this->getLocalizations($query, $con);
 }
Example #2
0
 /**
  * Gets the number of Localization objects related by a many-to-many relationship
  * to the current object by way of the kk_localization_variant cross-reference table.
  *
  * @param      Criteria $criteria Optional query object to filter the query
  * @param      boolean $distinct Set to true to force count distinct
  * @param      ConnectionInterface $con Optional connection object
  *
  * @return int the number of related Localization objects
  */
 public function countLocalizations(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
 {
     $partial = $this->collLocalizationsPartial && !$this->isNew();
     if (null === $this->collLocalizations || null !== $criteria || $partial) {
         if ($this->isNew() && null === $this->collLocalizations) {
             return 0;
         } else {
             if ($partial && !$criteria) {
                 return count($this->getLocalizations());
             }
             $query = ChildLocalizationQuery::create(null, $criteria);
             if ($distinct) {
                 $query->distinct();
             }
             return $query->filterByLanguageVariant($this)->count($con);
         }
     } else {
         return count($this->collLocalizations);
     }
 }
Example #3
0
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this Localization is new, it will return
  * an empty collection; or if this Localization has previously
  * been saved, it will retrieve related LocalizationsRelatedById from storage.
  *
  * This method is protected by default in order to keep the public
  * api reasonable.  You can provide public methods for those you
  * actually need in Localization.
  *
  * @param      Criteria $criteria optional Criteria object to narrow the query
  * @param      ConnectionInterface $con optional connection object
  * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
  * @return ObjectCollection|ChildLocalization[] List of ChildLocalization objects
  */
 public function getLocalizationsRelatedByIdJoinScript(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
 {
     $query = ChildLocalizationQuery::create(null, $criteria);
     $query->joinWith('Script', $joinBehavior);
     return $this->getLocalizationsRelatedById($query, $con);
 }
Example #4
0
 /**
  * Performs an INSERT on the database, given a Localization or Criteria object.
  *
  * @param mixed               $criteria Criteria or Localization object containing data that is used to create the INSERT statement.
  * @param ConnectionInterface $con the ConnectionInterface connection to use
  * @return mixed           The new primary key.
  * @throws PropelException Any exceptions caught during processing will be
  *                         rethrown wrapped into a PropelException.
  */
 public static function doInsert($criteria, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(LocalizationTableMap::DATABASE_NAME);
     }
     if ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
         // rename for clarity
     } else {
         $criteria = $criteria->buildCriteria();
         // build Criteria from Localization object
     }
     if ($criteria->containsKey(LocalizationTableMap::COL_ID) && $criteria->keyContainsValue(LocalizationTableMap::COL_ID)) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . LocalizationTableMap::COL_ID . ')');
     }
     // Set the correct dbName
     $query = LocalizationQuery::create()->mergeWith($criteria);
     // use transaction because $criteria could contain info
     // for more than one table (I guess, conceivably)
     return $con->transaction(function () use($con, $query) {
         return $query->doInsert($con);
     });
 }
Example #5
0
 /**
  * Get the associated ChildLocalization object
  *
  * @param  ConnectionInterface $con Optional Connection object.
  * @return ChildLocalization The associated ChildLocalization object.
  * @throws PropelException
  */
 public function getLocalization(ConnectionInterface $con = null)
 {
     if ($this->aLocalization === null && $this->localization_id !== null) {
         $this->aLocalization = ChildLocalizationQuery::create()->findPk($this->localization_id, $con);
         /* The following can be used additionally to
               guarantee the related object contains a reference
               to this object.  This level of coupling may, however, be
               undesirable since it could result in an only partially populated collection
               in the referenced object.
               $this->aLocalization->addApplicationUris($this);
            */
     }
     return $this->aLocalization;
 }
Example #6
0
 /**
  * Returns one Localization with the given id from cache
  * 
  * @param mixed $id
  * @return Localization|null
  */
 protected function get($id)
 {
     if ($this->pool === null) {
         $this->pool = new Map();
     } else {
         if ($this->pool->has($id)) {
             return $this->pool->get($id);
         }
     }
     $model = LocalizationQuery::create()->findOneById($id);
     $this->pool->set($id, $model);
     return $model;
 }
Example #7
0
 /**
  * Returns a new ChildLocalizationQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param     Criteria $criteria Optional Criteria to build the query from
  *
  * @return ChildLocalizationQuery
  */
 public static function create($modelAlias = null, Criteria $criteria = null)
 {
     if ($criteria instanceof ChildLocalizationQuery) {
         return $criteria;
     }
     $query = new ChildLocalizationQuery();
     if (null !== $modelAlias) {
         $query->setModelAlias($modelAlias);
     }
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }