/** * Prepare the instance to be run. * * @param Editor $editor Editor instance * @private */ private function _prep($editor) { $links = $this->_links; // Were links used to configure this instance - if so, we need to // back them onto the join array if ($this->_join['parent'] === null && count($links)) { $editorTable = $editor->table(); $editorTable = $editorTable[0]; $joinTable = $this->table(); if ($this->_aliasParentTable) { $editorTable = $this->_aliasParentTable; } if (count($links) === 2) { // No link table $f1 = explode('.', $links[0]); $f2 = explode('.', $links[1]); $this->_join['parent'] = $f1[1]; $this->_join['child'] = $f2[1]; } else { // Link table $f1 = explode('.', $links[0]); $f2 = explode('.', $links[1]); $f3 = explode('.', $links[2]); $f4 = explode('.', $links[3]); // Discover the name of the link table if ($f1[0] !== $editorTable && $f1[0] !== $joinTable) { $this->_join['table'] = $f1[0]; } else { if ($f2[0] !== $editorTable && $f2[0] !== $joinTable) { $this->_join['table'] = $f2[0]; } else { if ($f3[0] !== $editorTable && $f3[0] !== $joinTable) { $this->_join['table'] = $f3[0]; } else { $this->_join['table'] = $f2[0]; } } } $this->_join['parent'] = array($f1[1], $f2[1]); $this->_join['child'] = array($f3[1], $f4[1]); } } }
/** * Clean the database * @param \DataTables\Editor $editor Calling Editor instance * @param Field $field Host field * @internal */ public function dbCleanExec($editor, $field) { // Database and file system clean up BEFORE adding the new file to // the db, otherwise it will be removed immediately $tables = $editor->table(); $this->_dbClean($editor->db(), $tables[0], $field->dbField()); }