Hi.
I’ve a fairly simple functional test.
$this->assertSame(
5,
$this->subject->findAll()->count()
);
$this->subject->removeByProcessId(1002);
$this->assertSame(
4,
$this->subject->findAll()->count()
);
The first $this->subject->findAll()->count()
works like a charm, but the second after doing $this->subject->removeByProcessId(1002);
give me following error:
TypeError: Argument 1 passed to TYPO3\CMS\Core\Database\Query\QueryBuilder::unquoteSingleIdentifier() must be of the type string, null given
If I read the QueryBuilder.php
is says:
foreach ($this->getQueryPart('from') as $from) {
$tableName = $this->unquoteSingleIdentifier($from['table']);
$tableAlias = isset($from['alias']) ? $this->unquoteSingleIdentifier($from['alias']) : $tableName;
$queriedTables[$tableAlias] = $tableName;
}
so it’s the $this->tableName
that appears to be null on second findAll()
any hints on what I’m doing wrong or what to improve?
If i skippe the $this->subject->removeByProcessId(1002)
then I get
Failed asserting that 5 is identical to 4.
So the second findAll()
works like expected, but the removeBy
interrupts something.
This is my removeBy function
public function removeByProcessId($processId): void
{
$this->queryBuilder
->delete($this->tableName)
->where(
$this->queryBuilder->expr()->eq('process_id', $this->queryBuilder->createNamedParameter($processId))
)->execute();
}
so it’s fairly simple.. and should not do any harm