/** * @inheritdoc * @throws \BadMethodCallException * @throws \PeskyORM\Exception\DbConnectionConfigException * @throws \PeskyORM\Exception\DbModelException * @throws \PeskyORM\Exception\DbObjectException */ public function delete($conditionsAndOptions = null, $returning = false) { /** @var CmfDbModel|CacheForDbSelects $this */ $ret = parent::delete($conditionsAndOptions, $returning); if ($this->cachingIsPossible()) { if (!empty($ret[$this->getPkColumnName()])) { $ids = $ret[$this->getPkColumnName()]; } else { if (!empty($ret[0]) && !empty($ret[0][$this->getPkColumnName()])) { $ids = Set::extract('/' . $ret[$this->getPkColumnName()]); } else { if (!empty($conditionsAndOptions[$this->getPkColumnName()])) { $ids = $conditionsAndOptions[$this->getPkColumnName()]; } } } if (!empty($ids)) { if (!is_array($ids)) { $ids = array($ids); } foreach ($ids as $id) { $this->cleanRecordCache($id); } $this->cleanSelectManyCache(); } else { $this->cleanModelCache(); } } return $ret; }