/** * call mode handler * * @throws Exception * @return void */ public function main() { $modeSettings = $this->config->get('mode', $this->request->getMode()); if ($modeSettings === null) { throw new RuntimeException('mode `' . $this->request->getMode() . '` not applied'); } if (!isset($modeSettings['handler']) || !class_exists($modeSettings['handler'])) { throw new RuntimeException('mode `' . $this->request->getMode() . '` is invalid'); } $handler = new $modeSettings['handler']($this->config, $this->request, $modeSettings); if (!$handler instanceof AbstractModeHandler) { throw new RuntimeException('mode `' . $this->request->getMode() . '` handler `' . $modeSettings['handler'] . '` is not instance of `handler\\mode\\AbstractModeHandler`'); } $handler->handle(); }
/** * @param string $formId * @return bool */ protected function isStoredFormClose($formId) { $form = $this->getStoredFormData(); if ($form === null || !$this->isFormId($formId) || $form['formId'] !== $formId) { return false; } return $this->storedForms->get($this->request->getArea(), $this->request->getPage())['close']; }
/** * make MySQL DELETE * * @see Delete * @throws RuntimeException * @return bool */ public final function delete() { if ($this->isReadOnly()) { throw new RuntimeException('can\'t delete read only object'); } if (!$this->isFilled()) { throw new RuntimeException('nothing to delete'); } $this->toReadOnly(); $request = new Request($this->config, $this->accessPoint); $queryList = array(); for ($i = 0; $i < $this->getLength(); $i++) { $queryList[] = (new Delete($this->getTableName()))->addCondition($this->primaryKey, $this->columnList[$this->primaryKey]['type'], $this->content->get($i, $this->primaryKey))->setLimit(1)->assemble(); } try { $request->queryList($queryList); } catch (Exception $e) { return false; } return true; }