Hi guys!

I tried to filter ArrayCollection (entities with "startDate" field of 
datetime type) by this kind of criteria

$criteria = Criteria::create()->where(Criteria::expr()->eq("startDate", new 
DateTime()));
$result = $this->collection->matching($criteria);

But I found that this is not possible, because triple "=" avoids two object 
from being compared positively, due to this code:

Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php (lines 112 - 
116)

 switch ($comparison->getOperator()) {
  case Comparison::EQ:
      return function ($object) use ($field, $value) { 
        return ClosureExpressionVisitor::getObjectFieldValue($object, 
 $field)  === $value;
   }

I stopped using matching() in that case, but if doctrine let you to have 
DateTime field in entity, shouldn't it let developer to use that field in 
collections also?

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to