DDC-126: Design Query and AbstactQuery as Fluent Interface #158

Closed
opened 2026-01-22 12:28:58 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Nov 6, 2009).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @beberlei:

I would suggest to design the following methods on AbstractQuery/Query to be fluent. This would make lots of sense, since some methods might be called several times and configuration would be cumbersome.

A list of the affected methods:

AbstractQuery

public function setHint($name, $value)
public function setResultCacheId($id)
public function setHydrationMode($hydrationMode)
public function setExpireResultCache($expire = true)
public function setResultCacheLifetime($timeToLive)
public function useResultCache($bool, $timeToLive = null, $resultCacheId = null)
public function setResultCacheDriver($resultCacheDriver = null)
public function setResultSetMapping($rsm)
public function setParameters(array $params)
public function setParameter($key, $value)

Query

public function setExpireQueryCache($expire = true)
public function setQueryCacheLifetime($timeToLive)
public function setQueryCacheDriver($queryCache)
public function setDql($dqlQuery)

NativeQuery

public function setSql($sql)
Originally created by @doctrinebot on GitHub (Nov 6, 2009). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @beberlei: I would suggest to design the following methods on AbstractQuery/Query to be fluent. This would make lots of sense, since some methods might be called several times and configuration would be cumbersome. A list of the affected methods: AbstractQuery ``` public function setHint($name, $value) public function setResultCacheId($id) public function setHydrationMode($hydrationMode) public function setExpireResultCache($expire = true) public function setResultCacheLifetime($timeToLive) public function useResultCache($bool, $timeToLive = null, $resultCacheId = null) public function setResultCacheDriver($resultCacheDriver = null) public function setResultSetMapping($rsm) public function setParameters(array $params) public function setParameter($key, $value) ``` Query ``` public function setExpireQueryCache($expire = true) public function setQueryCacheLifetime($timeToLive) public function setQueryCacheDriver($queryCache) public function setDql($dqlQuery) ``` NativeQuery ``` public function setSql($sql) ```
admin added the New Feature label 2026-01-22 12:28:58 +01:00
admin closed this issue 2026-01-22 12:28:58 +01:00
Author
Owner

@doctrinebot commented on GitHub (Nov 6, 2009):

Comment created by romanb:

Two more suggestions:

setExpireResultCache => expireResultCache
setExpireQueryCache => expireQueryCache

@doctrinebot commented on GitHub (Nov 6, 2009): Comment created by romanb: Two more suggestions: setExpireResultCache => expireResultCache setExpireQueryCache => expireQueryCache
Author
Owner

@doctrinebot commented on GitHub (Nov 7, 2009):

Comment created by romanb:

After some pondering I think this is a good idea for consistency, especially where methods are concerned that are both on the Query and QueryBuilder APIs.

Go for it, but not before ALPHA3 is out!

@doctrinebot commented on GitHub (Nov 7, 2009): Comment created by romanb: After some pondering I think this is a good idea for consistency, especially where methods are concerned that are both on the Query and QueryBuilder APIs. Go for it, but not before ALPHA3 is out!
Author
Owner

@doctrinebot commented on GitHub (Nov 21, 2009):

Comment created by @beberlei:

Implemented and tested this, upgraded UPGRADE_TO_2_0.

@doctrinebot commented on GitHub (Nov 21, 2009): Comment created by @beberlei: Implemented and tested this, upgraded UPGRADE_TO_2_0.
Author
Owner

@doctrinebot commented on GitHub (Nov 21, 2009):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Nov 21, 2009): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#158