/** * @param $e * @return array * @throws * @throws \Exception */ protected function exceptionHandler($e) { // create view if it doesn't exist already // HACK $pdoMySQL = preg_match("/Base table or view not found/", $e->getMessage()); $Mysqli = preg_match("/Table (.*) doesn't exist/", $e->getMessage()); if (($Mysqli || $pdoMySQL) && $this->firstException) { $this->firstException = false; $localizedFields = new Object\Localizedfield(); $localizedFields->setClass(Object\ClassDefinition::getById($this->model->getClassId())); $localizedFields->createUpdateTable(); return $this->load(); } throw $e; }
/** * This method is called in Object|Class::save() and is used to create the database table for the localized data * @return void */ public function classSaved($class) { $localizedFields = new Object\Localizedfield(); $localizedFields->setClass($class); $localizedFields->createUpdateTable(); foreach ($this->getFieldDefinitions() as $fd) { if (method_exists($fd, "classSaved")) { $fd->classSaved($class); } } }
/** * This method is called in Object|Class::save() and is used to create the database table for the localized data * @return void */ public function classSaved($class, $params = []) { $localizedFields = new Object\Localizedfield(); $localizedFields->setClass($class); $context = isset($params["context"]) ? $params["context"] : null; $localizedFields->setContext($context); $localizedFields->createUpdateTable(); foreach ($this->getFieldDefinitions() as $fd) { if (method_exists($fd, "classSaved")) { $fd->classSaved($class, $params); } } }