Commit bc3c8c2e authored by doctrine's avatar doctrine

Docs updated

parent eb0eb44d
...@@ -381,6 +381,8 @@ final class Doctrine { ...@@ -381,6 +381,8 @@ final class Doctrine {
$fp = fopen(self::$path.DIRECTORY_SEPARATOR.'Doctrine.compiled.php', 'w+'); $fp = fopen(self::$path.DIRECTORY_SEPARATOR.'Doctrine.compiled.php', 'w+');
fwrite($fp, "<?php fwrite($fp, "<?php
".implode('', $ret)." ".implode('', $ret)."
class InvalidKeyException extends Exception { }
class DQLException extends Exception { }
?>"); ?>");
fclose($fp); fclose($fp);
} }
......
<?php
$query = new Doctrine_RawSql($session);
$query->parseQuery("SELECT {entity.*}, {phonenumber.*}
FROM entity
LEFT JOIN phonenumber
ON phonenumber.entity_id = entity.id");
$query->addComponent("entity", "Entity");
$query->addComponent("phonenumber", "Phonenumber");
$entities = $query->execute();
?>
<?php
class User extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn("uid","integer",20,"primary|autoincrement");
}
}
?>
Doctrine supports many kind of identifiers. For most cases it is recommended not to
specify any primary keys (Doctrine will then use field name 'id' as an autoincremented
primary key). When using table creation Doctrine is smart enough to emulate the
autoincrementation with sequences and triggers on databases that doesn't support it natively.
<?php <?php
class Doctrine_AccessTestCase extends Doctrine_UnitTestCase { class Doctrine_AccessTestCase extends Doctrine_UnitTestCase {
public function prepareData() { } public function prepareData() { }
public function prepareTables() {
$this->tables = array("Entity", "User");
parent::prepareTables();
}
public function testOffsetMethods() { public function testOffsetMethods() {
$user = new User(); $user = new User();
$this->assertEqual($user["name"],null); $this->assertEqual($user["name"],null);
......
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
require_once("UnitTestCase.php"); require_once("UnitTestCase.php");
class Doctrine_BatchIteratorTestCase extends Doctrine_UnitTestCase { class Doctrine_BatchIteratorTestCase extends Doctrine_UnitTestCase {
public function prepareTables() {
$this->tables = array("Entity", "User","Group","Address","Phonenumber");
parent::prepareTables();
}
public function testIterator() { public function testIterator() {
$graph = new Doctrine_Query($this->session); $graph = new Doctrine_Query($this->session);
$entities = $graph->query("FROM Entity"); $entities = $graph->query("FROM Entity");
......
<?php <?php
require_once("../Doctrine.compiled.php"); require_once("../Doctrine.php");
Doctrine::compile();
//require_once("../Doctrine.compiled.php");
//Doctrine::loadAll(); //Doctrine::loadAll();
function __autoload($class) { function __autoload($class) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment