Its Criteria::NOT_LIKE.

One tip, when doing LIKE queries to avoid prefixing the search clause with %
as that slows down the query an absolute ton. So ideally you want something
like...

$c->add(CommentsPeer::COMMENT, '%'.$variable.'%', Criteria::NOT_LIKE);

On Tue, Oct 26, 2010 at 2:16 AM, Parijat Kalia <[email protected]>wrote:

> Hey guys, trying to implement a criteria for my sql query which has a not
> like clause in it.
> this is how I proceed:
>
> $c->add(CommentsPeer::COMMENT,'likes',Criteria::NOTLIKE);
>
> I have also carried out trial and error with the following:
>
> $c->add(CommentsPeer::COMMENT,'likes',Criteria::NOT_LIKE);
> $c->add(CommentsPeer::COMMENT,'%likes%',Criteria::NOTLIKE);
> $c->add(CommentsPeer::COMMENT,'%likes%',Criteria::NOT_LIKE);
>
> also made use of not_equal
>
> $$c->add(CommentsPeer::COMMENT,'likes',Criteria::NOTEQUAL);
> $c->add(CommentsPeer::COMMENT,'likes',Criteria::NOT_EQUAL);
>
> None of these work, neither are they causing any background errors in the
> action within which they are called. Yet they always yield the 'likes' query
> in the results.
>
> Not sure what I am doing wrong here, would anybody like to point out any
> errors?
>
> Regards,
>
> Parijat Kalia
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<symfony-users%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to