Example #1
0
 public static function removeInstanceFromPool($value)
 {
     if ($value !== null) {
         if (is_object($value) && $value instanceof Item) {
             $key = (string) $value->getDataId();
         } elseif (is_scalar($value)) {
             // assume we've been passed a primary key
             $key = (string) $value;
         } else {
             $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or Item object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
             throw $e;
         }
         if ($memPool = static::getMemPool()) {
             $memPool->removeInstanceFromPool($key);
         }
         parent::removeInstanceFromPool($value);
     }
 }
Example #2
0
    }
    /**
     * Retrieve multiple objects by pkey.
     *
     * @param      array $pks List of primary keys
     * @param      PropelPDO $con the connection to use
     * @return Item[]
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
    public static function retrieveByPKs($pks, PropelPDO $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection(ItemPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }
        $objs = null;
        if (empty($pks)) {
            $objs = array();
        } else {
            $criteria = new Criteria(ItemPeer::DATABASE_NAME);
            $criteria->add(ItemPeer::DATA_ID, $pks, Criteria::IN);
            $objs = ItemPeer::doSelect($criteria, $con);
        }
        return $objs;
    }
}
// BaseItemPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseItemPeer::buildTableMap();