mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3472: Use REGEXP or RLIKE #4280
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Dec 31, 2014).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user sweetguy0883:
How can I use the REGEXP or RLIKE commands with Doctrine ORM? In most of the place over internet it says that this is not possible but all the posts are more than 1 year old. I found some function named getRegexpExpression() in https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php but don't know how to use it.
I am currently upgrading my old project and using php, doctrine and twig (not using any framework like Symfony2). I want to make a local php search (I don't want to use ElasticSearch or Solr as I am on a shared hosting). Lately I used some sql like "SELECT id FROM topics WHERE topic REGEXP ':<:something:>:'" . I am mainly searching for an alternative to my query for proper result.
$query = $entityManager->createNativeQuery("SELECT id FROM topics WHERE topic RLIKE ':<:something:>:'", $rsm); and it gives a null return value.
If there is any better option for making a search, that will also help me
@doctrinebot commented on GitHub (Dec 31, 2014):
Comment created by @ocramius:
Seems like
getRegexpExpressionis not being used at all by the ORM. I suggest you to look at how to write custom DQL functions as described in http://www.doctrine-project.org/2010/03/29/doctrine2-custom-dql-udfs.htmlNote that
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)can actually access the DB connection and then the platform viaDoctrine\ORM\Query\SqlWalker#getConnection().There is also a MySql specific implementation at
5e4ec9c3ec/lib/DoctrineExtensions/Query/Mysql/Regexp.phpThis won't be implemented in core so far, closing.
@doctrinebot commented on GitHub (Dec 31, 2014):
Issue was closed with resolution "Won't Fix"