remove() abstract public method

If $id is set only autogenerated entries will be removed.
abstract public remove ( string $action, mixed | null $id = null )
$action string
$id mixed | null
コード例 #1
0
 /**
  * Deletes all rows with given $action and optionally $id.
  *
  * If $id is set only autogenerated entries will be removed.
  *
  * @param string $action
  * @param mixed|null $id
  */
 public function remove($action, $id = null)
 {
     try {
         $this->innerGateway->remove($action, $id);
     } catch (DBALException $e) {
         throw new \RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new \RuntimeException('Database error', 0, $e);
     }
 }
コード例 #2
0
 /**
  * Recursively removes aliases by given $id and $action.
  *
  * $original parameter is used to limit removal of moved Location aliases to history entries only.
  *
  * @param mixed $id
  * @param string $action
  * @param mixed $original
  */
 protected function removeSubtree($id, $action, $original)
 {
     // Remove first to avoid unnecessary recursion.
     if ($original) {
         // If entry is original remove all for action (history and custom entries included).
         $this->gateway->remove($action);
     } else {
         // Else entry is history, so remove only for action with the id.
         // This means $id grouped history entries are removed, other history, active autogenerated
         // and custom are left alone.
         $this->gateway->remove($action, $id);
     }
     // Load all autogenerated for parent $id, including history.
     $entries = $this->gateway->loadAutogeneratedEntries($id, true);
     foreach ($entries as $entry) {
         $this->removeSubtree($entry['id'], $entry['action'], $entry['is_original']);
     }
 }