GraphAware\Neo4j\OGM\Persister\RelationshipPersister::getDeleteRelationshipQuery PHP Method

getDeleteRelationshipQuery() public method

public getDeleteRelationshipQuery ( $entityIdA, $entityIdB, RelationshipMetadata $relationship )
$relationship GraphAware\Neo4j\OGM\Metadata\RelationshipMetadata
    public function getDeleteRelationshipQuery($entityIdA, $entityIdB, RelationshipMetadata $relationship)
    {
        $relString = '';
        switch ($relationship->getDirection()) {
            case 'OUTGOING':
                $relString = '-[r:%s]->';
                break;
            case 'INCOMING':
                $relString = '<-[r:%s]-';
                break;
            case 'BOTH':
                $relString = '-[r:%s]-';
                break;
            default:
                throw new \InvalidArgumentException(sprintf('Direction "%s" is not valid', $relationship->getDirection()));
        }
        $relStringPart = sprintf($relString, $relationship->getType());
        $query = 'MATCH (a), (b) WHERE id(a) = {ida} AND id(b) = {idb}
        MATCH (a)' . $relStringPart . '(b)
        DELETE r';
        return Statement::create($query, ['ida' => $entityIdA, 'idb' => $entityIdB]);
    }