1
0
mirror of synced 2024-12-15 07:36:03 +03:00
doctrine2/manual/docs/Working with objects - Component overview - Query - Introduction.php

25 lines
954 B
PHP
Raw Normal View History

2007-04-14 01:49:11 +04:00
DQL (Doctrine Query Language) is a object query language which allows
2007-05-11 22:38:31 +04:00
you to find objects. DQL understands things like object relationships, polymorphism and
inheritance (including column aggregation inheritance).
2007-04-14 01:49:11 +04:00
For more info about DQL see the actual DQL chapter.
2007-04-14 01:49:11 +04:00
2007-05-11 22:38:31 +04:00
Doctrine_Query along with Doctrine_Expression provide an easy-to-use wrapper for writing DQL queries. Creating a new
2007-04-14 01:49:11 +04:00
query object can be done by either using the new operator or by calling create method. The create method exists for allowing easy
method call chaining.
<code type="php">
// initalizing a new Doctrine_Query (using the current connection)
$q = new Doctrine_Query();
// initalizing a new Doctrine_Query (using custom connection parameter)
// here $conn is an instance of Doctrine_Connection
$q = new Doctrine_Query($conn);
// an example using the create method
// here we simple fetch all users
2007-05-11 22:38:31 +04:00
$users = new Doctrine_Query::create()->from('User')->execute();
2007-04-14 01:49:11 +04:00
</code>