protected function deleteNode($path)
{
if ('/' == $path) {
throw new ConstraintViolationException('You can not delete the root node of a repository');
}
if (!$this->pathExists($path)) {
throw new ItemNotFoundException("No node found at " . $path);
}
$params = array($path, $path . "/%", $this->workspaceName);
// TODO on RDBMS that support deferred FKs we could skip this step
$query = 'SELECT id, path FROM phpcr_nodes WHERE (path = ? OR path LIKE ?) AND workspace_name = ?';
$stmt = $this->getConnection()->executeQuery($query, $params);
$this->referencesToDelete += $stmt->fetchAll(\PDO::FETCH_UNIQUE | \PDO::FETCH_COLUMN);
try {
$query = 'DELETE FROM phpcr_nodes WHERE (path = ? OR path LIKE ?) AND workspace_name = ?';
$this->getConnection()->executeUpdate($query, $params);
$this->cleanIdentifierCache($path);
} catch (DBALException $e) {
throw new RepositoryException('Unexpected exception while deleting node ' . $path, $e->getCode(), $e);
}
}