I have two tables:
users with fields id, project_id
projects with fields id, description
and project_id is foreign key.
I want to a delete method using Doctrine\DBAL\Query:
public function deleteUsers(int $projectId): void
{
$conn = $this->_em->getConnection();
$qb = $conn->createQueryBuilder();
$qb->delete('u')
->from('users', 'u')
->innerJoin('u', 'projects', 'p', 'u.project_id = p.id')
->where('p.id=
rojectId');
$qb->setParameter('projectId', $projectId);
var_dump($qb->getSQL());
}
and I get:
string(39) "DELETE FROM u WHERE u.project_id =
rojectId"
I don't undestand why not appear the INNER JOIN.
What is the sintax error?
Continue reading...
users with fields id, project_id
projects with fields id, description
and project_id is foreign key.
I want to a delete method using Doctrine\DBAL\Query:
public function deleteUsers(int $projectId): void
{
$conn = $this->_em->getConnection();
$qb = $conn->createQueryBuilder();
$qb->delete('u')
->from('users', 'u')
->innerJoin('u', 'projects', 'p', 'u.project_id = p.id')
->where('p.id=
$qb->setParameter('projectId', $projectId);
var_dump($qb->getSQL());
}
and I get:
string(39) "DELETE FROM u WHERE u.project_id =
I don't undestand why not appear the INNER JOIN.
What is the sintax error?
Continue reading...