/** * Return TRUE is the current query * can use a cache. * * @param string $class Class name * * @return bool */ protected final function canUseCache($class) { if (!$this->driver instanceof CacheDriver) { return FALSE; } if (!$this->driver_enabled) { $enabled = $this->driver->isEnabled(); if (!$enabled) { return FALSE; } $this->driver_enabled = TRUE; } $enable = isset_static_variable($class, 'cacheable') ? get_static_variable($class, 'cacheable') : $this->enabled; return $enable; }
static final function presence_of_update($class, $obj) { if (isset_static_variable($class, 'validates_presence_of')) { foreach ((array) get_static_variable($class, 'validates_presence_of') as $property) { if (isset($obj['$unset'][$property])) { throw new ActiveMongo_FilterException("Cannot delete required property {$property}"); } } } }