Paradox/toolbox/PodManager.php
public function delete(AModel $model)
    {
        $driver = $this->_toolbox->getDriver();
        $pod = $model->getPod();

        //Signal here
        $this->notify("before_delete", $pod);

        try {
            if ($pod instanceof Vertex) {

                if ($this->hasTransaction()) {
                    $id = $this->determinePreviouslyStored($model);
                    $this->_toolbox->getTransactionManager()->addWriteCollection($this->_toolbox->getVertexCollectionName());

                    if ($id !== false) {
                        $this->addTransactionCommand("function () {graph.removeVertex(graph.getVertex(result.$id._id)); return true;}();", "PodManager:delete", $model, true);
                    } else {
                        $this->addTransactionCommand("function () {graph.removeVertex(graph.getVertex('{$pod->getId()}')); return true;}();", "PodManager:delete", $model, true);
                    }

                } else {
                    $driver->removeVertex($this->_toolbox->getGraph(), $pod->getId());
                }

            } elseif ($pod instanceof Edge) {

                if ($this->hasTransaction()) {
                    $id = $this->determinePreviouslyStored($model);
                    $this->_toolbox->getTransactionManager()->addWriteCollection($this->_toolbox->getEdgeCollectionName());

                    if ($id !== false) {
                        $this->addTransactionCommand("function () {graph.removeEdge(graph.getEdge(result.$id._id)); return true;}();", "PodManager:delete", $model, true);
                    } else {
                        $this->addTransactionCommand("function () {graph.removeEdge(graph.getEdge('{$pod->getId()}')); return true;}();", "PodManager:delete", $model, true);
                    }

                } else {
                    $driver->removeEdge($this->_toolbox->getGraph(), $pod->getId());
                }

            } else {

                if ($this->hasTransaction()) {

                    $id = $this->determinePreviouslyStored($model);
                    $this->_toolbox->getTransactionManager()->addWriteCollection($pod->getType());

                    if ($id !== false) {
                        $this->addTransactionCommand("function () {db.{$pod->getType()}.remove(result.$id._id, true); return true;}();", "PodManager:delete", $model);
                    } else {
                        $this->addTransactionCommand("function () {db.{$pod->getType()}.remove('{$pod->getId()}', true); return true;}();", "PodManager:delete", $model);
                    }

                } else {
                    $driver->delete($pod->toDriverDocument());
                }

            }
        } catch (\Exception $e) {
            $normalised = $this->_toolbox->normaliseDriverExceptions($e);
            throw new PodManagerException($normalised['message'], $normalised['code']);
        }

        if (!$this->hasTransaction()) {
            return $this->processDeleteResult($pod);
        }

    }
public function delete(AModel $model)
    {
        $driver = $this->_toolbox->getDriver();
        $pod = $model->getPod();

        //Signal here
        $this->notify("before_delete", $pod);

        try {
            if ($pod instanceof Vertex) {

                if ($this->hasTransaction()) {
                    $id = $this->determinePreviouslyStored($model);
                    $this->_toolbox->getTransactionManager()->addWriteCollection($this->_toolbox->getVertexCollectionName());

                    if ($id !== false) {
                        $this->addTransactionCommand("function () {graph.removeVertex(graph.getVertex(result.$id._id)); return true;}();", "PodManager:delete", $model, true);
                    } else {
                        $this->addTransactionCommand("function () {graph.removeVertex(graph.getVertex('{$pod->getId()}')); return true;}();", "PodManager:delete", $model, true);
                    }

                } else {
                    $driver->removeVertex($this->_toolbox->getGraph(), $pod->getId());
                }

            } elseif ($pod instanceof Edge) {

                if ($this->hasTransaction()) {
                    $id = $this->determinePreviouslyStored($model);
                    $this->_toolbox->getTransactionManager()->addWriteCollection($this->_toolbox->getEdgeCollectionName());

                    if ($id !== false) {
                        $this->addTransactionCommand("function () {graph.removeEdge(graph.getEdge(result.$id._id)); return true;}();", "PodManager:delete", $model, true);
                    } else {
                        $this->addTransactionCommand("function () {graph.removeEdge(graph.getEdge('{$pod->getId()}')); return true;}();", "PodManager:delete", $model, true);
                    }

                } else {
                    $driver->removeEdge($this->_toolbox->getGraph(), $pod->getId());
                }

            } else {

                if ($this->hasTransaction()) {

                    $id = $this->determinePreviouslyStored($model);
                    $this->_toolbox->getTransactionManager()->addWriteCollection($pod->getType());

                    if ($id !== false) {
                        $this->addTransactionCommand("function () {db.{$pod->getType()}.remove(result.$id._id, true); return true;}();", "PodManager:delete", $model);
                    } else {
                        $this->addTransactionCommand("function () {db.{$pod->getType()}.remove('{$pod->getId()}', true); return true;}();", "PodManager:delete", $model);
                    }

                } else {
                    $driver->delete($pod->toDriverDocument());
                }

            }
        } catch (\Exception $e) {
            $normalised = $this->_toolbox->normaliseDriverExceptions($e);
            throw new PodManagerException($normalised['message'], $normalised['code']);
        }

        if (!$this->hasTransaction()) {
            return $this->processDeleteResult($pod);
        }

    }
Deletes a model from the server.
@param  AModel  $model
@return boolean