Example #1
0
 /**
  * Add (or replace) to the instance pool.
  *
  * @param Model $object
  */
 static function insertIntoPool(Model $object)
 {
     if (!static::$_poolEnabled || static::$_instancePoolCount >= static::MAX_INSTANCE_POOL_SIZE || empty(static::$_primaryKeys)) {
         return;
     }
     $pool_key = implode('-', $object->getPrimaryKeyValues());
     if (empty($pool_key)) {
         return;
     }
     if (!isset(static::$_instancePool[$pool_key])) {
         ++static::$_instancePoolCount;
     }
     static::$_instancePool[$pool_key] = $object;
 }