public static function where($args) { $where = array(); if (count($args) == 1) { foreach ($args[0] as $field => $val) { $where[$field] = $field == '_id' ? Basemongo::MongoId($val) : $val; } } elseif (count($args) == 2) { $where[$args[0]] = $args[0] == '_id' ? Basemongo::MongoId($args[1]) : $args[1]; } elseif (count($args) == 3 && ($op = self::checkOp($args[1], 'where'))) { $where = array($args[0] => array(htmlentities($op) => self::opScopes($op, $args[2]))); } return $where; }
public static function mongoId($id) { if (!self::$_mongoId->isValid($id)) { exit('invalid id'); } return Basemongo::MongoId($id); }