/** * Eliminates the record from the cache. * * @inheritdoc */ public function delete($key) { $this->activerecord_cache->eliminate($key); return parent::delete($key); }
/** * Deletes a record. * * @param mixed $key Identifier of the record. * * @return bool */ public function delete($key) { if ($this->parent) { $this->parent->delete($key); } $where = 'where '; if (is_array($this->primary)) { $parts = []; foreach ($this->primary as $identifier) { $parts[] = '`' . $identifier . '` = ?'; } $where .= implode(' and ', $parts); } else { $where .= '`{primary}` = ?'; } $statement = $this->prepare('delete from `{self}` ' . $where); $statement((array) $key); return !!$statement->rowCount(); }