1
0
mirror of synced 2024-12-15 07:36:03 +03:00
doctrine2/manual/docs/en/dql-doctrine-query-language/from-clause.txt
2007-10-17 21:16:49 +00:00

23 lines
880 B
Plaintext

Syntax:
<code type="sql">
FROM <component_reference> [[LEFT | INNER] JOIN <component_reference>] ...
</code>
The {{FROM}} clause indicates the component or components from which to retrieve records. If you name more than one component, you are performing a join. For each table specified, you can optionally specify an alias.
Consider the following DQL query:
<code type="sql">
FROM User u
</code>
Here 'User' is the name of the class (component) and 'u' is the alias. You should always use short aliases, since most of the time those make the query much shorther and also because when using for example caching the cached form of the query takes less space when short aliases are being used.
The following example shows how to fetch all records from class 'User'.
<code type="php">
$users = Doctrine_Query::create()
->from('User u')
->execute();
</code>