Commit 50d7fdd2 authored by phuson's avatar phuson

fixed typo

parent 3be60344
++ Introduction ++ Introduction
++ SELECT queries ++ SELECT queries
++ UPDATE queries ++ UPDATE queries
++ DELETE queries ++ DELETE queries
++ FROM clause ++ FROM clause
++ JOIN syntax ++ JOIN syntax
++ INDEXBY keyword ++ INDEXBY keyword
++ WHERE clause ++ WHERE clause
++ Conditional expressions ++ Conditional expressions
++ Functional Expressions ++ Functional Expressions
++ Subqueries ++ Subqueries
++ GROUP BY, HAVING clauses ++ GROUP BY, HAVING clauses
++ ORDER BY clause ++ ORDER BY clause
++ LIMIT and OFFSET clauses ++ LIMIT and OFFSET clauses
++ Examples ++ Examples
++ The Query Registry ++ 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. 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. 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"> <code type="php">
$r = Doctrine_Manager::getInstance()->getQueryRegistry(); $r = Doctrine_Manager::getInstance()->getQueryRegistry();
$r->add('all-users', 'FROM User u'); $r->add('all-users', 'FROM User u');
</code> </code>
+++ Namespaces +++ 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. 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 available in its local scope.
<code type="php"> <code type="php">
$r = Doctrine_Manager::getInstance()->getQueryRegistry(); $r = Doctrine_Manager::getInstance()->getQueryRegistry();
$r->add('User/all', 'FROM User u'); $r->add('User/all', 'FROM User u');
$r->add('User/byName', 'FROM User u WHERE u.name = ?'); $r->add('User/byName', 'FROM User u WHERE u.name = ?');
$user = new User(); $user = new User();
// find the user named Jack Daniels // find the user named Jack Daniels
$user = $user->findOne('byName', array('Jack Daniels')); $user = $user->findOne('byName', array('Jack Daniels'));
// find all users // find all users
$users = $user->find('all'); $users = $user->find('all');
</code> </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