Ticket #1331 (closed defect: fixed)

Opened 11 months ago

Last modified 10 months ago

is orWhere here to stay?

Reported by: hansbrix Owned by: guilhermeblanco
Priority: minor Milestone: 1.0.0
Component: Query/Hydration Version: 1.0.0
Severity: Keywords: dql
Cc: Has Test: no
Status: Pending Core Response Has Patch: no

Description

francoisz mentioned that orWhere isn't documented, it's just a magic method (first i've even heard of it, actually). is support for this planned? if so, it should be documented. it can be useful for simple OR conditions, but some confusion arises from the DQL API over it. i'll post a separate ticket on this.

Attachments

orwhere.diff (8.0 KB) - added by jwage 11 months ago.

Change History

Changed 11 months ago by francois

hm, it seems this method only appears in the trunk unit tests, so it is probably not anywhere else. It doesn't exist in 0.11.

Changed 11 months ago by guilhermeblanco

  • owner changed from jwage to guilhermeblanco

The current structure does not support OR/AND changes.

I refactored this part in trunk (2.0) to support OR/AND inclusions, but it cannot be backported (since it doesn't have _dqlParts array in 2.0).

Maybe in a deep change I can try to adapt it to work in 1.0, but I cannot be 100% it'll be possible.

Actually what's done internally? $q->addWhere($where) does: $this->_dqlPartswhere?[] = $where;

And later when $q->getDqlQuery() is called: $where = implode(' AND ', $this->_dqlPartswhere?);

I already spoke with jonwage about this change, but we both agreed that change the DQL parser now may lead to unexpected situations. I'm forwarding this ticket to 1.1, maybe I can refactor Doctrine_Query in a later stage and update source.

Cheers,

Changed 11 months ago by jwage

  • component changed from Attributes to Query/Hydration
  • milestone changed from Unknown to 1.0.0-RC1

Changed 11 months ago by jwage

  • version changed from 0.11 to 1.0

Changed 11 months ago by jwage

We will have to hack this functionality in to Doctrine 1.0. It is already correctly implemented in trunk but due to some deeper problems we can't implement it as cleanly as is done in trunk. Attached is something I put together to add the following methods:

andWhere()
andWhereIn()
andWhereNotIn()
orWhere()
orWhereIn()
orWhereNotIn()

The and method are essentially just proxy methods as they already exist, but to match the or api I created the proxies.

Changed 11 months ago by jwage

Changed 11 months ago by jwage

Note: The attached patch still has many problems that need to be talked about and worked on.

Changed 11 months ago by guilhermeblanco

  • milestone changed from 1.0.0-RC1 to 1.0.0

We are changing the priority of items to address the most important ones for RC1.

Changed 10 months ago by guilhermeblanco

  • status changed from new to closed
  • resolution set to fixed

(In [4848]) fixes #1331. Added andWhere, andWhereIn, andWhereNotIn, orWhere, orWhereIn, orWhereNotIn support to 1.0. Added some coverage to this support.

Note: See TracTickets for help on using tickets.