Changeset 4846

Show
Ignore:
Timestamp:
08/27/08 07:20:38 (5 months ago)
Author:
guilhermeblanco
Message:

Include documentation of Named Query support.

Location:
branches/1.0/docs/manual/en
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/docs/manual/en/dql-doctrine-query-language.txt

    r4674 r4846  
    1414++ LIMIT and OFFSET clauses 
    1515++ Examples 
    16 ++ The Query Registry 
    17  
    18 Doctrine_Query_Registry is a class for registering and naming queries. It helps with the organization of your applications  
    19 queries and along with that it offers some very nice convenience stuff. 
    20  
    21 The queries are added using the add() method of the registry object. It takes two parameters, the query name and the actual  
    22 DQL query. 
    23  
    24 <code type="php"> 
    25 $r = Doctrine_Manager::getInstance()->getQueryRegistry(); 
    26  
    27 $r->add('all-users', 'FROM User u'); 
    28 </code> 
    29  
    30 +++ Namespaces 
    31  
    32 The Query registry supports namespaces. The namespace is separated from the actual name with / -mark. If the name of the  
    33 namespace is a record name the given record has all the named queries available in its local scope. 
    34  
    35 <code type="php"> 
    36 $r = Doctrine_Manager::getInstance()->getQueryRegistry(); 
    37  
    38 $r->add('User/all', 'FROM User u'); 
    39 $r->add('User/byName', 'FROM User u WHERE u.name = ?'); 
    40  
    41 $userTable = Doctrine::getTable('User'); 
    42  
    43 // find the user named Jack Daniels 
    44 $user = $userTable->findOneByName('Jack Daniels'); 
    45  
    46 // find all users 
    47 $users = $userTable->find('all'); 
    48 </code> 
    49  
     16++ Named Queries 
    5017++ BNF 
    51  
    5218++ Magic Finders 
    5319