Initial entry.
This commit is contained in:
parent
3864591b8d
commit
303e84c347
55
playground/data.php
Normal file
55
playground/data.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
$groups = new Doctrine_Collection($conn->getTable('Group'));
|
||||
|
||||
$groups[0]->name = 'Drama Actors';
|
||||
|
||||
$groups[1]->name = 'Quality Actors';
|
||||
|
||||
|
||||
$groups[2]->name = 'Action Actors';
|
||||
$groups[2]['Phonenumber'][0]->phonenumber = '123 123';
|
||||
$groups->save();
|
||||
|
||||
$users = new Doctrine_Collection('User');
|
||||
|
||||
|
||||
$users[0]->name = 'zYne';
|
||||
$users[0]['Email']->address = 'zYne@example.com';
|
||||
$users[0]['Phonenumber'][0]->phonenumber = '123 123';
|
||||
|
||||
$users[1]->name = 'Arnold Schwarzenegger';
|
||||
$users[1]->Email->address = 'arnold@example.com';
|
||||
$users[1]['Phonenumber'][0]->phonenumber = '123 123';
|
||||
$users[1]['Phonenumber'][1]->phonenumber = '456 456';
|
||||
$users[1]->Phonenumber[2]->phonenumber = '789 789';
|
||||
$users[1]->Group[0] = $groups[2];
|
||||
|
||||
$users[2]->name = 'Michael Caine';
|
||||
$users[2]->Email->address = 'caine@example.com';
|
||||
$users[2]->Phonenumber[0]->phonenumber = '123 123';
|
||||
|
||||
$users[3]->name = 'Takeshi Kitano';
|
||||
$users[3]->Email->address = 'kitano@example.com';
|
||||
$users[3]->Phonenumber[0]->phonenumber = '111 222 333';
|
||||
|
||||
$users[4]->name = 'Sylvester Stallone';
|
||||
$users[4]->Email->address = 'stallone@example.com';
|
||||
$users[4]->Phonenumber[0]->phonenumber = '111 555 333';
|
||||
$users[4]['Phonenumber'][1]->phonenumber = '123 213';
|
||||
$users[4]['Phonenumber'][2]->phonenumber = '444 555';
|
||||
|
||||
$users[5]->name = 'Kurt Russell';
|
||||
$users[5]->Email->address = 'russell@example.com';
|
||||
$users[5]->Phonenumber[0]->phonenumber = '111 222 333';
|
||||
|
||||
$users[6]->name = 'Jean Reno';
|
||||
$users[6]->Email->address = 'reno@example.com';
|
||||
$users[6]->Phonenumber[0]->phonenumber = '111 222 333';
|
||||
$users[6]['Phonenumber'][1]->phonenumber = '222 123';
|
||||
$users[6]['Phonenumber'][2]->phonenumber = '123 456';
|
||||
|
||||
$users[7]->name = 'Edward Furlong';
|
||||
$users[7]->Email->address = 'furlong@example.com';
|
||||
$users[7]->Phonenumber[0]->phonenumber = '111 567 333';
|
||||
|
||||
$users->save();
|
1
playground/doctrine
Symbolic link
1
playground/doctrine
Symbolic link
@ -0,0 +1 @@
|
||||
../lib/
|
2
playground/index.php
Normal file
2
playground/index.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
require_once('playground.php');
|
1
playground/models
Symbolic link
1
playground/models
Symbolic link
@ -0,0 +1 @@
|
||||
../models/
|
50
playground/playground.php
Normal file
50
playground/playground.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
ini_set('max_execution_time', 900);
|
||||
|
||||
// include doctrine, and register it's autoloader
|
||||
require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'doctrine/Doctrine.php';
|
||||
|
||||
spl_autoload_register(array('Doctrine', 'autoload'));
|
||||
|
||||
$modelsPath = dirname(__FILE__).DIRECTORY_SEPARATOR.'models';
|
||||
|
||||
// include the models
|
||||
$models = new DirectoryIterator($modelsPath);
|
||||
foreach($models as $key => $file) {
|
||||
if ($file->isFile() && ! $file->isDot()) {
|
||||
$e = explode('.', $file->getFileName());
|
||||
if (end($e) === 'php') {
|
||||
require_once $file->getPathname();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
$dbh = new PDO('sqlite::memory:');
|
||||
$conn = Doctrine_Manager::connection($dbh);
|
||||
$manager = Doctrine_Manager::getInstance();
|
||||
|
||||
$manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL);
|
||||
|
||||
$tables = array('entity',
|
||||
'entityReference',
|
||||
'email',
|
||||
'phonenumber',
|
||||
'groupuser',
|
||||
'album',
|
||||
'song',
|
||||
'element',
|
||||
'error',
|
||||
'description',
|
||||
'address',
|
||||
'account',
|
||||
'task',
|
||||
'resource',
|
||||
'assignment',
|
||||
'resourceType',
|
||||
'resourceReference');
|
||||
|
||||
$conn->export->exportClasses($tables);
|
||||
|
||||
require_once('data.php');
|
Loading…
Reference in New Issue
Block a user