当前位置: 首页>>代码示例>>PHP>>正文


PHP Propel::isInstancePoolingEnabled方法代码示例

本文整理汇总了PHP中Propel::isInstancePoolingEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Propel::isInstancePoolingEnabled方法的具体用法?PHP Propel::isInstancePoolingEnabled怎么用?PHP Propel::isInstancePoolingEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Propel的用法示例。


在下文中一共展示了Propel::isInstancePoolingEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInstanceFromIdPool

 public static function getInstanceFromIdPool($key)
 {
     if (Propel::isInstancePoolingEnabled() && isset(self::$assetInstancesById[$key])) {
         return self::$assetInstancesById[$key];
     }
     return null;
 }
开发者ID:kubrickfr,项目名称:server,代码行数:7,代码来源:assetPeer.php

示例2: doesPathExist

 /**
  * @param string $entityType
  * @param string $path
  * @return bool
  */
 public static function doesPathExist($entityType, $path)
 {
     $path = static::_normalize($path);
     $pathKey = self::_pathKey($entityType, $path);
     if (\Propel::isInstancePoolingEnabled() && ($obj = static::getInstanceFromPool($pathKey))) {
         return true;
     }
     $count = EntryQuery::create($entityType)->filterByPath($path)->count();
     return $count > 0;
 }
开发者ID:e1himself,项目名称:axis-materialized-path-repository-plugin,代码行数:15,代码来源:EntryPeer.php

示例3: testInstancePoolingReenabled

 public function testInstancePoolingReenabled()
 {
     Propel::enableInstancePooling();
     $books = PropelQuery::from('Book')->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find($this->con);
     foreach ($books as $book) {
     }
     $this->assertTrue(Propel::isInstancePoolingEnabled());
     Propel::disableInstancePooling();
     $books = PropelQuery::from('Book')->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find($this->con);
     foreach ($books as $book) {
     }
     $this->assertFalse(Propel::isInstancePoolingEnabled());
     Propel::enableInstancePooling();
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:14,代码来源:PropelOnDemandIteratorTest.php

示例4: execute

 /**
  * Populate the database using all the Entity classes previously added.
  *
  * @param PropelPDO $con A Propel connection object
  *
  * @return array A list of the inserted PKs
  */
 public function execute($con = null)
 {
     if (null === $con) {
         $con = $this->getConnection();
     }
     $isInstancePoolingEnabled = \Propel::isInstancePoolingEnabled();
     \Propel::disableInstancePooling();
     $insertedEntities = array();
     $con->beginTransaction();
     foreach ($this->quantities as $class => $number) {
         for ($i = 0; $i < $number; $i++) {
             $insertedEntities[$class][] = $this->entities[$class]->execute($con, $insertedEntities);
         }
     }
     $con->commit();
     if ($isInstancePoolingEnabled) {
         \Propel::enableInstancePooling();
     }
     return $insertedEntities;
 }
开发者ID:ncuesta,项目名称:Faker,代码行数:27,代码来源:Populator.php

示例5: format

 public function format(PDOStatement $stmt)
 {
     $this->checkInit();
     if ($class = $this->collectionName) {
         $collection = new $class();
         $collection->setModel($this->class);
         $collection->setFormatter($this);
     } else {
         $collection = array();
     }
     if ($this->isWithOneToMany()) {
         if ($this->hasLimit) {
             throw new PropelException('Cannot use limit() in conjunction with with() on a one-to-many relationship. Please remove the with() call, or the limit() call.');
         }
         $pks = array();
         $objectsByPks = array();
         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
             $object = $this->getAllObjectsFromRow($row);
             $pk = $object->getPrimaryKey();
             if (false === Propel::isInstancePoolingEnabled()) {
                 if (isset($objectsByPks[$pk])) {
                     $this->mainObject = $objectsByPks[$pk];
                     $object = $this->getAllObjectsFromRow($row);
                 }
                 $objectsByPks[$pk] = $object;
             }
             if (!in_array($pk, $pks)) {
                 $collection[] = $object;
                 $pks[] = $pk;
             }
         }
     } else {
         // only many-to-one relationships
         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
             $collection[] = $this->getAllObjectsFromRow($row);
         }
     }
     $stmt->closeCursor();
     return $collection;
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:40,代码来源:PropelObjectFormatter.php

示例6: testSetUp

 public function testSetUp()
 {
     $this->assertTrue(Propel::isInstancePoolingEnabled());
     $this->assertEquals(2, count($this->author->getBooks()));
     $this->assertEquals(2, $this->author->countBooks());
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:6,代码来源:PoisonedCacheBugTest.php

示例7: getInstanceFromPool

 /**
  * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
  *
  * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
  * a multi-column primary key, a serialize()d version of the primary key will be returned.
  *
  * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
  * @return Empleadofacturacion Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
  * @see        getPrimaryKeyHash()
  */
 public static function getInstanceFromPool($key)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if (isset(EmpleadofacturacionPeer::$instances[$key])) {
             return EmpleadofacturacionPeer::$instances[$key];
         }
     }
     return null;
     // just to be explicit
 }
开发者ID:jalvarez14,项目名称:hva,代码行数:20,代码来源:BaseEmpleadofacturacionPeer.php

示例8: getInstanceFromPool

 /**
  * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
  *
  * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
  * a multi-column primary key, a serialize()d version of the primary key will be returned.
  *
  * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
  * @return GalleryImageSize Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
  * @see        getPrimaryKeyHash()
  */
 public static function getInstanceFromPool($key)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if (isset(GalleryImageSizePeer::$instances[$key])) {
             return GalleryImageSizePeer::$instances[$key];
         }
     }
     return null;
     // just to be explicit
 }
开发者ID:jorisros,项目名称:sfWidgetCKEditorPlugin,代码行数:20,代码来源:BaseGalleryImageSizePeer.php

示例9: getInstanceFromPool

 /**
  * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
  *
  * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
  * a multi-column primary key, a serialize()d version of the primary key will be returned.
  *
  * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
  * @return   Procedimientregrogramado Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
  * @see        getPrimaryKeyHash()
  */
 public static function getInstanceFromPool($key)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if (isset(ProcedimientregrogramadoPeer::$instances[$key])) {
             return ProcedimientregrogramadoPeer::$instances[$key];
         }
     }
     return null;
     // just to be explicit
 }
开发者ID:eddypre,项目名称:Quirofano,代码行数:20,代码来源:BaseProcedimientregrogramadoPeer.php

示例10: populateRelation

 /**
  * Makes an additional query to populate the objects related to the collection objects
  * by a certain relation
  *
  * @param string    $relation Relation name (e.g. 'Book')
  * @param Criteria  $criteria Optional Criteria object to filter the related object collection
  * @param PropelPDO $con      Optional connection object
  *
  * @return PropelObjectCollection The list of related objects
  *
  * @throws PropelException
  */
 public function populateRelation($relation, $criteria = null, $con = null)
 {
     if (!Propel::isInstancePoolingEnabled()) {
         throw new PropelException('populateRelation() needs instance pooling to be enabled prior to populating the collection');
     }
     $relationMap = $this->getFormatter()->getTableMap()->getRelation($relation);
     if ($this->isEmpty()) {
         // save a useless query and return an empty collection
         $coll = new PropelObjectCollection();
         $coll->setModel($relationMap->getRightTable()->getClassname());
         return $coll;
     }
     $symRelationMap = $relationMap->getSymmetricalRelation();
     $query = PropelQuery::from($relationMap->getRightTable()->getClassname());
     if (null !== $criteria) {
         $query->mergeWith($criteria);
     }
     // query the db for the related objects
     $filterMethod = 'filterBy' . $symRelationMap->getName();
     $relatedObjects = $query->{$filterMethod}($this)->find($con);
     if ($relationMap->getType() == RelationMap::ONE_TO_MANY) {
         // initialize the embedded collections of the main objects
         $relationName = $relationMap->getName();
         foreach ($this as $mainObj) {
             $mainObj->initRelation($relationName);
         }
         // associate the related objects to the main objects
         $getMethod = 'get' . $symRelationMap->getName();
         $addMethod = 'add' . $relationName;
         foreach ($relatedObjects as $object) {
             $mainObj = $object->{$getMethod}();
             // instance pool is used here to avoid a query
             $mainObj->{$addMethod}($object);
         }
         $relatedObjects->clearIterator();
     } elseif ($relationMap->getType() == RelationMap::MANY_TO_ONE) {
         // nothing to do; the instance pool will catch all calls to getRelatedObject()
         // and return the object in memory
     } else {
         throw new PropelException('populateRelation() does not support this relation type');
     }
     return $relatedObjects;
 }
开发者ID:szabobeni,项目名称:benstore,代码行数:55,代码来源:PropelObjectCollection.php

示例11: getInstanceFromPool

 /**
  * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
  *
  * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
  * a multi-column primary key, a serialize()d version of the primary key will be returned.
  *
  * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
  * @return Proveedoritradeservicio Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
  * @see        getPrimaryKeyHash()
  */
 public static function getInstanceFromPool($key)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if (isset(ProveedoritradeservicioPeer::$instances[$key])) {
             return ProveedoritradeservicioPeer::$instances[$key];
         }
     }
     return null;
     // just to be explicit
 }
开发者ID:vicbaporu,项目名称:ITRADE,代码行数:20,代码来源:BaseProveedoritradeservicioPeer.php

示例12: updateLoadedNode

 /**
  * Reload all already loaded nodes to sync them with updated db
  *
  * @param      sfAssetFolder $node	Propel object for parent node
  * @param      int $delta	Value to be shifted by, can be negative
  * @param      PropelPDO $con		Connection to use.
  */
 protected static function updateLoadedNode(NodeObject $node, $delta, PropelPDO $con = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         $keys = array();
         foreach (self::$instances as $obj) {
             $keys[] = $obj->getPrimaryKey();
         }
         if (!empty($keys)) {
             // We don't need to alter the object instance pool; we're just modifying these ones
             // already in the pool.
             $criteria = new Criteria(self::DATABASE_NAME);
             $criteria->add(sfAssetFolderPeer::ID, $keys, Criteria::IN);
             $stmt = sfAssetFolderPeer::doSelectStmt($criteria, $con);
             while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
                 $key = sfAssetFolderPeer::getPrimaryKeyHashFromRow($row, 0);
                 if (null !== ($object = sfAssetFolderPeer::getInstanceFromPool($key))) {
                     $object->setLeftValue($row[1]);
                     $object->setRightValue($row[2]);
                 }
             }
             $stmt->closeCursor();
         }
     }
 }
开发者ID:rafaelccomp,项目名称:compsite,代码行数:31,代码来源:BasesfAssetFolderNestedSetPeer.php

示例13: getInstanceFromPool

 /**
  * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
  *
  * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
  * a multi-column primary key, a serialize()d version of the primary key will be returned.
  *
  * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
  * @return SubscriberGroupMembership Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
  * @see        getPrimaryKeyHash()
  */
 public static function getInstanceFromPool($key)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if (isset(SubscriberGroupMembershipPeer::$instances[$key])) {
             return SubscriberGroupMembershipPeer::$instances[$key];
         }
     }
     return null;
     // just to be explicit
 }
开发者ID:rapila,项目名称:plugin-newsletter,代码行数:20,代码来源:BaseSubscriberGroupMembershipPeer.php

示例14: populateRelation

 /**
  * Makes an additional query to populate the objects related to the collection objects
  * by a certain relation
  *
  * @param     string    $relation Relation name (e.g. 'Book')
  * @param     Criteria  $criteria Optional Criteria object to filter the related object collection
  * @param     PropelPDO $con      Optional connection object
  *
  * @return    PropelObjectCollection the list of related objects
  */
 public function populateRelation($relation, $criteria = null, $con = null)
 {
     if (!Propel::isInstancePoolingEnabled()) {
         throw new PropelException('populateRelation() needs instance pooling to be enabled prior to populating the collection');
     }
     $relationMap = $this->getFormatter()->getTableMap()->getRelation($relation);
     $symRelationMap = $relationMap->getSymmetricalRelation();
     // query the db for the related objects
     $useMethod = 'use' . $symRelationMap->getName() . 'Query';
     $query = PropelQuery::from($relationMap->getRightTable()->getPhpName());
     if (null !== $criteria) {
         $query->mergeWith($criteria);
     }
     $relatedObjects = $query->{$useMethod}()->filterByPrimaryKeys($this->getPrimaryKeys())->endUse()->find($con);
     // associate the related objects to the main objects
     if ($relationMap->getType() == RelationMap::ONE_TO_MANY) {
         $getMethod = 'get' . $symRelationMap->getName();
         $addMethod = 'add' . $relationMap->getName();
         foreach ($relatedObjects as $object) {
             $mainObj = $object->{$getMethod}();
             // instance pool is used here to avoid a query
             $mainObj->{$addMethod}($object);
         }
     } elseif ($relationMap->getType() == RelationMap::MANY_TO_ONE) {
         // nothing to do; the instance pool will catch all calls to getRelatedObject()
         // and return the object in memory
     } else {
         throw new PropelException('populateRelation() does not support this relation type');
     }
     return $relatedObjects;
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:41,代码来源:PropelObjectCollection.php

示例15: getInstanceFromPool

 /**
  * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
  *
  * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
  * a multi-column primary key, a serialize()d version of the primary key will be returned.
  *
  * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
  * @return LanguageObjectHistory Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
  * @see        getPrimaryKeyHash()
  */
 public static function getInstanceFromPool($key)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if (isset(LanguageObjectHistoryPeer::$instances[$key])) {
             return LanguageObjectHistoryPeer::$instances[$key];
         }
     }
     return null;
     // just to be explicit
 }
开发者ID:rapila,项目名称:cms-base,代码行数:20,代码来源:BaseLanguageObjectHistoryPeer.php


注:本文中的Propel::isInstancePoolingEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。