*/
static function getClassKV($cls, $k, $v=null)
{
- if (!is_a($cls, __CLASS__, true)) {
- throw new Exception('Trying to fetch ' . __CLASS__ . ' into a non-related class');
- }
if (is_null($v)) {
$v = $k;
$keys = self::pkeyCols($cls);
*/
static function pivotGetClass($cls, $keyCol, array $keyVals, array $otherCols = array())
{
- if (!is_a($cls, __CLASS__, true)) {
- throw new Exception('Trying to fetch ' . __CLASS__ . ' into a non-related class');
- }
if (is_array($keyCol)) {
foreach ($keyVals as $keyVal) {
$result[implode(',', $keyVal)] = null;
static function pkeyCols($cls)
{
- if (!is_a($cls, __CLASS__, true)) {
- throw new Exception('Trying to fetch ' . __CLASS__ . ' into a non-related class');
- }
$i = new $cls;
$types = $i->keyTypes();
ksort($types);
static function listFindClass($cls, $keyCol, array $keyVals)
{
- if (!is_a($cls, __CLASS__, true)) {
- throw new Exception('Trying to fetch ' . __CLASS__ . ' into a non-related class');
- }
-
$i = new $cls;
$i->whereAddIn($keyCol, $keyVals, $i->columnType($keyCol));
if (!$i->find()) {
throw new NoResultException($i);
}
- sprintf(__CLASS__ . "() got {$i->N} results for class $cls key $keyCol");
return $i;
}
static function listGetClass($cls, $keyCol, array $keyVals)
{
- if (!is_a($cls, __CLASS__, true)) {
- throw new Exception('Trying to fetch ' . __CLASS__ . ' into a non-related class');
- }
$pkeyMap = array_fill_keys($keyVals, array());
$result = array_fill_keys($keyVals, array());
$pkeyMap[$i->$keyCol][] = $pkeyVal;
}
} catch (NoResultException $e) {
- // no results foudn for our keyVals, so we leave them as empty arrays
+ // no results found for our keyVals, so we leave them as empty arrays
}
foreach ($toFetch as $keyVal) {
self::cacheSet(sprintf("%s:list-ids:%s:%s", strtolower($cls), $keyCol, $keyVal),
*/
static function pkeyGetClass($cls, array $kv)
{
- if (!is_a($cls, __CLASS__, true)) {
- throw new Exception('Trying to fetch ' . __CLASS__ . ' into a non-related class');
- }
$i = Memcached_DataObject::multicache($cls, $kv);
if ($i !== false) { // false == cache miss
return $i;
function _connect()
{
- global $_DB_DATAOBJECT;
+ global $_DB_DATAOBJECT, $_PEAR;
$sum = $this->_getDbDsnMD5();
if (!empty($_DB_DATAOBJECT['CONNECTIONS'][$sum]) &&
- !PEAR::isError($_DB_DATAOBJECT['CONNECTIONS'][$sum])) {
+ !$_PEAR->isError($_DB_DATAOBJECT['CONNECTIONS'][$sum])) {
$exists = true;
} else {
$exists = false;