phpcr/phpcr-utils — Issue #4: Sql2ToQomQueryConverter doesn't validate statements
Author: piotras
Created: 2011-12-06 14:20:46+00:00
State: open

I am using this test: https://github.com/doctrine/phpcr-odm/blob/master/tests/Doctrine/Tests/ODM/PHPCR/Functional/QuerySql2Test.php#L22

And get this error:
1) Doctrine\Tests\ODM\PHPCR\Functional\QuerySql2Test::testQuery with data set #4 ('invalidstatement', -1)
Argument 1 passed to Midgard\PHPCR\Query\QOM\QueryObjectModelFactory::createQuery() must implement interface PHPCR\Query\QOM\SourceInterface, null given, called in PHPCR/Util/QOM/Sql2ToQomQueryConverter.php on line 69 and defined

Midgard/PHPCR/src/Midgard/PHPCR/Query/QOM/QueryObjectModelFactory.php:12
jackalope/lib/phpcr-utils/src/PHPCR/Util/QOM/Sql2ToQomQueryConverter.php:69
Midgard/PHPCR/src/Midgard/PHPCR/Query/SQLQuery.php:22

SQLQuery simply does:

$this->query = $this->converter->parse($statement);

where $statement is statement from odm test.

There's no way to catch any exception or validate query returned by converter's parse method.