* Made the documentation directory structure a bit more logical by moving 'docs/en/root.txt' to 'docs/en.txt'.
* Found two more sections from the old documentation that are not yet converted to the new format.
This commit is contained in:
parent
5fefbbd8c1
commit
591cbe406d
@ -0,0 +1,124 @@
|
||||
Whenever you fetch records with eg. Doctrine_Table::findAll or Doctrine_Connection::query methods an instance of
|
||||
Doctrine_Collection is returned. There are many types of collections in Doctrine and it is crucial to understand
|
||||
the differences of these collections. Remember choosing the right fetching strategy (collection type) is one of the most
|
||||
influental things when it comes to boosting application performance.
|
||||
|
||||
|
||||
|
||||
* Immediate Collection
|
||||
Fetches all records and all record data immediately into collection memory. Use this collection only if you really need to show all that data
|
||||
in web page.
|
||||
|
||||
|
||||
|
||||
Example query:
|
||||
|
||||
SELECT id, name, type, created FROM user
|
||||
|
||||
|
||||
|
||||
* Batch Collection
|
||||
Fetches all record primary keys into colletion memory. When individual collection elements are accessed this collection initializes proxy objects.
|
||||
When the non-primary-key-property of a proxy object is accessed that object sends request to Batch collection which loads the data
|
||||
for that specific proxy object as well as other objects close to that proxy object.
|
||||
|
||||
|
||||
|
||||
Example queries:
|
||||
|
||||
SELECT id FROM user
|
||||
|
||||
SELECT id, name, type, created FROM user WHERE id IN (1,2,3,4,5)
|
||||
|
||||
SELECT id, name, type, created FROM user WHERE id IN (6,7,8,9,10)
|
||||
|
||||
[ ... ]
|
||||
|
||||
|
||||
* Lazy Collection
|
||||
Lazy collection is exactly same as Batch collection with batch size preset to one.
|
||||
|
||||
|
||||
|
||||
Example queries:
|
||||
|
||||
SELECT id FROM user
|
||||
|
||||
SELECT id, name, type, created FROM user WHERE id = 1
|
||||
|
||||
SELECT id, name, type, created FROM user WHERE id = 2
|
||||
|
||||
SELECT id, name, type, created FROM user WHERE id = 3
|
||||
|
||||
[ ... ]
|
||||
|
||||
|
||||
* Offset Collection
|
||||
Offset collection is the same as immediate collection with the difference that it uses database provided limiting of queries.
|
||||
|
||||
|
||||
|
||||
Example queries:
|
||||
|
||||
SELECT id, name, type, created FROM user LIMIT 5
|
||||
|
||||
SELECT id, name, type, created FROM user LIMIT 5 OFFSET 5
|
||||
|
||||
SELECT id, name, type, created FROM user LIMIT 5 OFFSET 10
|
||||
|
||||
[ ... ]
|
||||
|
||||
|
||||
|
||||
<code type="php">
|
||||
$table = $conn->getTable("User");
|
||||
|
||||
$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_IMMEDIATE);
|
||||
|
||||
$users = $table->findAll();
|
||||
|
||||
// or
|
||||
|
||||
$users = $conn->query("FROM User-I"); // immediate collection
|
||||
|
||||
foreach($users as $user) {
|
||||
print $user->name;
|
||||
}
|
||||
|
||||
|
||||
$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_LAZY);
|
||||
|
||||
$users = $table->findAll();
|
||||
|
||||
// or
|
||||
|
||||
$users = $conn->query("FROM User-L"); // lazy collection
|
||||
|
||||
foreach($users as $user) {
|
||||
print $user->name;
|
||||
}
|
||||
|
||||
$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_BATCH);
|
||||
|
||||
$users = $table->findAll();
|
||||
|
||||
// or
|
||||
|
||||
$users = $conn->query("FROM User-B"); // batch collection
|
||||
|
||||
foreach($users as $user) {
|
||||
print $user->name;
|
||||
}
|
||||
|
||||
$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_OFFSET);
|
||||
|
||||
$users = $table->findAll();
|
||||
|
||||
// or
|
||||
|
||||
$users = $conn->query("FROM User-O"); // offset collection
|
||||
|
||||
foreach($users as $user) {
|
||||
print $user->name;
|
||||
}
|
||||
</code>
|
@ -0,0 +1,3 @@
|
||||
There are three possible ways to access the properties of a record (fields of database row).
|
||||
You can use overloading, ArrayAccess interface or simply Doctrine_Record::get() method.
|
||||
**Doctrine_Record objects have always all properties in lowercase**.
|
@ -43,7 +43,7 @@ if ($revision > $cacheRev) {
|
||||
|
||||
if ($cache->begin()) {
|
||||
|
||||
$tool = new DocTool('docs/en/root.txt');
|
||||
$tool = new DocTool('docs/en.txt');
|
||||
// $tool->setOption('clean-url', true);
|
||||
|
||||
$supportedLangs = array('en', 'fi');
|
||||
|
4
vendor/Sensei/Sensei/Doc/Section.php
vendored
4
vendor/Sensei/Sensei/Doc/Section.php
vendored
@ -314,6 +314,10 @@ class Sensei_Doc_Section implements Countable
|
||||
$file = file($path . DIRECTORY_SEPARATOR . $filename);
|
||||
$current = $this;
|
||||
|
||||
if ($this->isRoot()) {
|
||||
$path .= DIRECTORY_SEPARATOR . basename($filename, '.txt');
|
||||
}
|
||||
|
||||
foreach ($file as $lineNum => $line) {
|
||||
|
||||
// Checks if the line is a heading
|
||||
|
Loading…
x
Reference in New Issue
Block a user