Added ExpressionBuilder::nolike() method #153

Merged
merged 2 commits into from Jan 8, 2013

4 participants

@alvarezmario

While working on a project in which I'm using the Dbal QueryBuilder, I found that the API doesn't provide a notlike() method, which I definitely need.
In the end, using the like() method I solve the problem, but in an ugly way(IMO): $qb->expr()->like('a.host NOT', $qb->expr()->literal('%.com'))

That's why I think there should exists the notlike() method in the API.
Thoughts?

@travisbot

This pull request passes (merged 3c5ad7d into cb0cda2).

@stof stof and 1 other commented on an outdated diff May 21, 2012
lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php
@@ -248,6 +248,19 @@ public function like($x, $y)
{
return $this->comparison($x, 'LIKE', $y);
}
+
+ /**
+ * Creates a NOT LIKE() comparison expression with the given arguments.
+ *
+ * @param string $x Field in string format to be inspected by NOT LIKE() comparison.
+ * @param mixed $y Argument to be used in NOT LIKE() comparison.
+ *
+ * @return string
+ */
+ public function notlike($x, $y)
@stof
Doctrine member
stof added a note May 21, 2012

it should be notLike

Fixed. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@alvarezmario

The ORM ExpressionBuilder class also lacks this method. If it is accepted to be added I can also make a pull request there too.

nomack84 Fixed CS 81f5c2f
@travisbot

This pull request passes (merged 81f5c2f into cb0cda2).

@hason

Is there any problem?

@guilhermeblanco guilhermeblanco merged commit fed3d65 into doctrine:master Jan 8, 2013
@alvarezmario alvarezmario deleted the alvarezmario:add_notlike_method_to_expressionbuilder branch Feb 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment