[DDC-2430] Incorrect results when using ->matching on PersistentCollection Created: 05/May/13 Updated: 09/May/13 Resolved: 09/May/13 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.4 |
| Fix Version/s: | 2.4 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Stuart Carnie | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | criteria | ||
| Environment: |
Ubuntu 12.04 LTS, PHP 5.4.14 |
||
| Description |
|
When using ->matching() on a PersistentCollection that is already loaded, it returns incorrect results when trying to match by id on a relationship. // NOTE: the user property is a M:1 relationship of $entity // $res is empty, even if $userId exists |
| Comments |
| Comment by Benjamin Eberlei [ 09/May/13 ] |
|
The problem is that matching a user by just the id doesn't work for in memory here. |
| Comment by Benjamin Eberlei [ 09/May/13 ] |
|
Fixed and introduced a BC break for this. See https://github.com/doctrine/doctrine2/commit/30f90a6f49d46d2f367ac774aa77e0c7ce1a573f#L0R31 for information. |
[DDC-2394] QueryExpressionVisitor has no implementation of Comparison::CONTAINS Created: 08/Apr/13 Updated: 14/Apr/13 Resolved: 14/Apr/13 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | Git Master |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Boris Guéry | Assignee: | Benjamin Eberlei |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | criteria, expression, orm, query | ||
| Environment: |
n/a |
||
| Description |
|
Use case
$criteria = Criteria::create();
$criteria
->andWhere(
$criteria->expr()->contains('r.body', 'foo')
)
;
$entities = $repo->createQueryBuilder()->addCriteria($criteria)->getQuery()->getResult();
Throws the following exception: RuntimeException: Unknown comparison operator: CONTAINS
I except it to properly handle the CONTAINS comparison and result in a LIKE operator. ------- I added a failing test case & a fix there: https://github.com/borisguery/doctrine2/tree/DDC-2394 |
| Comments |
| Comment by Benjamin Eberlei [ 14/Apr/13 ] |
|
This was added in 2.4, you are probably using Collections 1.1 with ORM 2.3, where this occurs. |
[DDC-2378] Efficient count using Selectable Created: 28/Mar/13 Updated: 28/Mar/13 Resolved: 28/Mar/13 |
|
| Status: | Closed |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.3.2 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major |
| Reporter: | Michaël Gallego | Assignee: | Marco Pivetta |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | criteria, selectable | ||
| Description |
|
Hi, I'm currently using intensively the Criteria and Selectable interfaces to provide a generic REST library. However, I've found a problem when I want to paginate data: count return count($this->selectable->matching(new Criteria())); The problem is that EntityRepository returns an ArrayCollection and, hence, load the whole collection which is inefficient. It would be nice if it could return a PersistentCollection instead with lazy-load and perform an optimized count. Thanks |
| Comments |
| Comment by Christophe Coevoet [ 28/Mar/13 ] |
|
duplicate of DDC-2217 |
[DDC-2061] Matching Criteria on a PersistentCollection only works on OneToMany associations Created: 08/Oct/12 Updated: 08/Oct/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | Git Master |
| Fix Version/s: | Git Master |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Terje Bråten | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | criteria, matching | ||
| Description |
|
What is needed to make it also work for ManyToMany associations? May be a better fallback would be do an ArrayCollection->matching() instead of just giving a runtime exception? Is this something that is difficult to implement? |