1
0
mirror of synced 2024-12-14 23:26:04 +03:00
doctrine2/manual/new/docs/en/dql-doctrine-query-language/from-clause.txt
2007-09-06 16:31:07 +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>