Commit ea838412 authored by zYne's avatar zYne

--no commit message

--no commit message
parent 7435ec30
...@@ -13,4 +13,34 @@ ...@@ -13,4 +13,34 @@
++ ORDER BY clause ++ ORDER BY clause
++ LIMIT and OFFSET clauses ++ LIMIT and OFFSET clauses
++ Examples ++ Examples
++ The Query Registry
Doctrine_Query_Registry is a class for registering and naming queries. It helps with the organization of your applications queries and along with that it offers some very nice convenience stuff.
The queries are added using the add() method of the registry object. It takes two parameters, the query name and the actual DQL query.
<code type="php">
$r = Doctrine_Manager::getInstance()->getQueryRegistry();
$r->add('all-users', 'FROM User u');
</code>
+++ Namespaces
The Query registry supports namespaces. The namespace is separated from the actual name with / -mark. If the name of the namespace is a record name the given record has all the named queries availible in its local scope.
<code type="php">
$r = Doctrine_Manager::getInstance()->getQueryRegistry();
$r->add('User/all', 'FROM User u');
$r->add('User/byName', 'FROM User u WHERE u.name = ?');
$user = new User();
// fetch the user named Jack Daniels
$user = $user->fetchOne('byName', array('Jack Daniels'));
// fetch all users
$users = $user->fetch('all');
</code>
++ BNF ++ BNF
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment