Exemplo n.º 1
0
 /**
  * Post-processing after this object has beens deleted.
  *
  * This routine is responsible for deleting the 'extra' data (attributes, categories,
  * and meta data) from the database and the optionally creating an
  * entry in the object-log table.
  *
  * @param mixed   $object  The object wehave just saved.
  * @param string  $table   The treated table reference.
  * @param integer $idfield The id column for the object/table combination.
  *
  * @deprecated
  * @see    CategorisableListener, AttributableListener, MetaDataListener, LoggableListener
  * @return void
  */
 private static function _deletePostProcess($object, $table, $idfield)
 {
     $tables = self::getTables();
     $enableAllServices = isset($tables["{$table}_db_extra_enable_all"]) && $tables["{$table}_db_extra_enable_all"];
     if (($enableAllServices || isset($tables["{$table}_db_extra_enable_categorization"]) && $tables["{$table}_db_extra_enable_categorization"]) && System::getVar('Z_CONFIG_USE_OBJECT_CATEGORIZATION') && $table != 'categories_' && $table != 'objectdata_attributes' && $table != 'objectdata_log' && ModUtil::available('ZikulaCategoriesModule')) {
         ObjectUtil::deleteObjectCategories($object, $table, $idfield);
     }
     if ((isset($tables["{$table}_db_extra_enable_all"]) && $tables["{$table}_db_extra_enable_all"] || isset($tables["{$table}_db_extra_enable_attribution"]) && $tables["{$table}_db_extra_enable_attribution"] || System::getVar('Z_CONFIG_USE_OBJECT_ATTRIBUTION')) && $table != 'objectdata_attributes' && $table != 'objectdata_log') {
         ObjectUtil::deleteObjectAttributes($object, $table, $idfield);
     }
     if (($enableAllServices || isset($tables["{$table}_db_extra_enable_meta"]) && $tables["{$table}_db_extra_enable_meta"] || System::getVar('Z_CONFIG_USE_OBJECT_META')) && $table != 'objectdata_attributes' && $table != 'objectdata_meta' && $table != 'objectdata_log') {
         ObjectUtil::deleteObjectMetaData($object, $table, $idfield);
     }
     if (($enableAllServices || isset($tables["{$table}_db_extra_enable_logging"]) && $tables["{$table}_db_extra_enable_logging"]) && System::getVar('Z_CONFIG_USE_OBJECT_LOGGING') && strcmp($table, 'objectdata_log') !== 0) {
         $log = new ObjectData_Log();
         $log['object_type'] = $table;
         $log['object_id'] = $object[$idfield];
         $log['op'] = 'D';
         $log['diff'] = serialize($object);
         $log->save();
     }
 }
Exemplo n.º 2
0
 /**
  * Delete all attribtes after an delete.
  *
  * @param Doctrine_Event $event Event.
  *
  * @return void
  */
 public function postDelete(Doctrine_Event $event)
 {
     $data = $event->getInvoker();
     if (!isset($data['__ATTRIBUTES__'])) {
         return;
     }
     $tableName = $this->getTableNameFromEvent($event);
     $idColumn = $this->getIdColumnFromEvent($event);
     $dataForObjectUtil = array();
     $dataForObjectUtil[$idColumn] = $data[$idColumn];
     ObjectUtil::deleteObjectAttributes($dataForObjectUtil, $tableName, $idColumn);
 }