DDC-995: Expr::literal problem #1242

Closed
opened 2026-01-22 13:06:59 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Jan 22, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user bandirsen:

I'm not sure if this Doctrine 2 default behavior or a bug

When I try to call Expr::literal directly in an user class it produce error:
" Call to undefined method AnUserClass::_quoteLiteral() "

here are code example:

use Doctrine\ORM\Query\Expr;

class AnUserClass
{   
    public function test()
    {
        $aProductNumber  = '123456';
        $criteria = Expr::eq( 'entity.productnumber', Expr::literal($aProductNumber) );
    }
}

calling $AnUserClass->test() will produce the error.

I see that internaly *Expr::literal()* static method calling $this->_quoteLiteral() method,
IMO it should self::_quoteLiteral() since it is a class level method not instance level method.

Please close this report if this is not a bug or already fixed.
Regards

Originally created by @doctrinebot on GitHub (Jan 22, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user bandirsen: I'm not sure if this Doctrine 2 default behavior or a bug When I try to call Expr::literal directly in an user class it produce error: " Call to undefined method AnUserClass::_quoteLiteral() " here are code example: ``` use Doctrine\ORM\Query\Expr; class AnUserClass { public function test() { $aProductNumber = '123456'; $criteria = Expr::eq( 'entity.productnumber', Expr::literal($aProductNumber) ); } } ``` calling $AnUserClass->test() will produce the error. I see that internaly **Expr::literal()\* static method calling *$this->_quoteLiteral()** method, IMO it should **self::_quoteLiteral()** since it is a class level method not instance level method. Please close this report if this is not a bug or already fixed. Regards
admin added the Bug label 2026-01-22 13:06:59 +01:00
admin closed this issue 2026-01-22 13:07:00 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jan 22, 2011):

Comment created by bandirsen:

forget to set priority, affected version and component
sorry for this, I not fluent on using Jira :(

@doctrinebot commented on GitHub (Jan 22, 2011): Comment created by bandirsen: forget to set priority, affected version and component sorry for this, I not fluent on using Jira :(
Author
Owner

@doctrinebot commented on GitHub (Jan 23, 2011):

Comment created by @beberlei:

Where did you see Expr being used as static class? Its an instance/object to be used $qb->expr()->literal(), you can instantiate it in your code using new Expr() and call $expr->literal().

@doctrinebot commented on GitHub (Jan 23, 2011): Comment created by @beberlei: Where did you see Expr being used as static class? Its an instance/object to be used $qb->expr()->literal(), you can instantiate it in your code using new Expr() and call $expr->literal().
Author
Owner

@doctrinebot commented on GitHub (Jan 23, 2011):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Jan 23, 2011): Issue was closed with resolution "Invalid"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1242