Darko Luketic
2013-04-13 07:43:37 UTC
ORM
findby('game' => ?)
without using the querybuilder (because that's even more confusing)
http://docs.doctrine-project.org/en/latest/reference/working-with-associations.html#filtering-collections
It says "You can build expressions through the ExpressionBuilder"
Okay, but how, where?
Also IsNotNull isn't there in 2.4.0RC1 (in ExpressionBuilder)
And it's not the only criterion. The rest are default = expressions.
->findBy([
'voter' => $user,
'value' => 1,
'game' => criteria is not null
]);
I don't know wouldn't it be better if one could do something like this in
findBy?:
findBy([
'id' => [Expression::eq, 1],
'related' => $that,
'someothervalue' => [Expression::lt, 100],
'yaval' => 'somestring',
'ayaval' => [Expression::like, '%somestring']
])
so it checks if $value is an array and if it is replace the = with the new
expression.
foreach ($criteria as $key => $val)
{
if (!is_array($val))
{
// Expression is '='
}
else
{
// Expression is $val[0]
}
// rest
}
anyhow .. how do I findBy not null?
findby('game' => ?)
without using the querybuilder (because that's even more confusing)
http://docs.doctrine-project.org/en/latest/reference/working-with-associations.html#filtering-collections
It says "You can build expressions through the ExpressionBuilder"
Okay, but how, where?
Also IsNotNull isn't there in 2.4.0RC1 (in ExpressionBuilder)
And it's not the only criterion. The rest are default = expressions.
->findBy([
'voter' => $user,
'value' => 1,
'game' => criteria is not null
]);
I don't know wouldn't it be better if one could do something like this in
findBy?:
findBy([
'id' => [Expression::eq, 1],
'related' => $that,
'someothervalue' => [Expression::lt, 100],
'yaval' => 'somestring',
'ayaval' => [Expression::like, '%somestring']
])
so it checks if $value is an array and if it is replace the = with the new
expression.
foreach ($criteria as $key => $val)
{
if (!is_array($val))
{
// Expression is '='
}
else
{
// Expression is $val[0]
}
// rest
}
anyhow .. how do I findBy not null?
--
You received this message because you are subscribed to the Google Groups "doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to doctrine-user+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to doctrine-user-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/doctrine-user?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to doctrine-user+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to doctrine-user-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/doctrine-user?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.