2007-05-24 17:02:26 +04:00
|
|
|
<?php
|
|
|
|
require_once dirname(__FILE__) . '/../lib/Doctrine.php';
|
|
|
|
|
|
|
|
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
|
|
|
|
spl_autoload_register(array('Doctrine', 'autoload'));
|
|
|
|
require_once 'classes.php';
|
|
|
|
require_once dirname(__FILE__) . '/../models/location.php';
|
|
|
|
|
2007-05-24 17:04:57 +04:00
|
|
|
print "<pre>";
|
|
|
|
|
2007-05-24 17:02:26 +04:00
|
|
|
$manager = Doctrine_Manager::getInstance();
|
|
|
|
$dbh = Doctrine_Db::getConnection('sqlite::memory:');
|
|
|
|
$conn = $manager->openConnection($dbh);
|
2007-05-27 22:56:54 +04:00
|
|
|
/**
|
2007-05-24 17:02:26 +04:00
|
|
|
$user = new User();
|
|
|
|
$user->name = 'zYne';
|
|
|
|
$user->Phonenumber[0]->phonenumber = '123 123';
|
|
|
|
if ($user === $user->Phonenumber[0]->entity_id) {
|
2007-05-24 17:04:57 +04:00
|
|
|
print 'case 1 works\n';
|
2007-05-24 17:02:26 +04:00
|
|
|
}
|
|
|
|
$city = new Record_City();
|
|
|
|
$city->name = 'City 1';
|
|
|
|
$city->District->name = 'District 1';
|
|
|
|
|
|
|
|
if ($city->District === $city->district_id) {
|
2007-05-24 17:04:57 +04:00
|
|
|
print 'case 2 works\n';
|
2007-05-24 17:02:26 +04:00
|
|
|
}
|
2007-05-27 22:56:54 +04:00
|
|
|
*/
|
2007-05-24 17:02:26 +04:00
|
|
|
|
|
|
|
$c = new Record_Country();
|
|
|
|
$c->name = 'Some country';
|
2007-05-27 22:56:54 +04:00
|
|
|
$city = $c->City[0];
|
|
|
|
$city->name = 'City 1';
|
|
|
|
$city->District->name = 'District 1';
|
2007-05-24 17:02:26 +04:00
|
|
|
|
2007-05-27 22:56:54 +04:00
|
|
|
$c->save();
|