1
0
mirror of synced 2025-01-17 22:11:41 +03:00

moved all models to trunk/models. removed some old invalid testcases

This commit is contained in:
meus 2007-09-02 14:24:49 +00:00
parent 7127f12e2c
commit e360684d1b
195 changed files with 2137 additions and 2400 deletions

10
models/Account.php Normal file
View File

@ -0,0 +1,10 @@
<?php
class Account extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('entity_id', 'integer');
$this->hasColumn('amount', 'integer');
}
}

13
models/Address.php Normal file
View File

@ -0,0 +1,13 @@
<?php
class Address extends Doctrine_Record
{
public function setUp()
{
$this->hasMany('User', array('local' => 'address_id',
'foreign' => 'user_id',
'refClass' => 'EntityAddress'));
}
public function setTableDefinition() {
$this->hasColumn('address', 'string', 200);
}
}

11
models/Album.php Normal file
View File

@ -0,0 +1,11 @@
<?php
class Album extends Doctrine_Record {
public function setUp() {
$this->ownsMany('Song', 'Song.album_id');
}
public function setTableDefinition() {
$this->hasColumn('user_id', 'integer');
$this->hasColumn('name', 'string',20);
}
}

13
models/App.php Normal file
View File

@ -0,0 +1,13 @@
<?php
class App extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string', 32);
$this->hasColumn('user_id', 'integer', 11);
$this->hasColumn('app_category_id', 'integer', 11);
}
public function setUp() {
$this->hasOne('User', 'User.id');
$this->hasMany('App_Category as Category', 'App_Category.id');
}
}

11
models/App_Category.php Normal file
View File

@ -0,0 +1,11 @@
<?php
class App_Category extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string', 32);
$this->hasColumn('parent_id', 'integer');
}
public function setUp() {
$this->hasMany('App', 'App.app_category_id');
$this->hasMany('App_Category as Parent', 'App_Category.parent_id');
}
}

15
models/App_User.php Normal file
View File

@ -0,0 +1,15 @@
<?php
class App_User extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('first_name', 'string', 32);
$this->hasColumn('last_name', 'string', 32);
$this->hasColumn('email', 'string', 128, 'email');
$this->hasColumn('username', 'string', 16, 'unique, nospace');
$this->hasColumn('password', 'string', 128, 'notblank');
$this->hasColumn('country', 'string', 2, 'country');
$this->hasColumn('zipcode', 'string', 9, 'nospace');
}
public function setUp() {
$this->hasMany('App', 'App.user_id');
}
}

8
models/Assignment.php Normal file
View File

@ -0,0 +1,8 @@
<?php
class Assignment extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('task_id', 'integer');
$this->hasColumn('resource_id', 'integer');
}
}

14
models/Auth.php Normal file
View File

@ -0,0 +1,14 @@
<?php
class Auth extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('roleid', 'integer', 10);
$this->hasColumn('name', 'string', 50);
}
public function setUp()
{
$this->hasOne('Role', array('local' => 'roleid', 'foreign' => 'id'));
}
}

7
models/Author.php Normal file
View File

@ -0,0 +1,7 @@
<?php
class Author extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('book_id', 'integer');
$this->hasColumn('name', 'string',20);
}
}

View File

@ -0,0 +1,8 @@
<?php
class BadLyNamed__Class extends Doctrine_Record {
public function setTableDefinition() {
}
public function setUp() { }
}

13
models/BarRecord.php Normal file
View File

@ -0,0 +1,13 @@
<?php
class BarRecord extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('bar');
$this->hasColumn('name', 'string', 200);
}
public function setUp()
{
$this->hasMany('FooRecord as Foo', array('local' => 'barId', 'foreign' => 'fooId', 'refClass' => 'FooBarRecord'));
}
}

View File

@ -0,0 +1,10 @@
<?php
class BoardWithPosition extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('position', 'integer');
$this->hasColumn('category_id', 'integer');
}
public function setUp() {
$this->hasOne('CategoryWithPosition as Category', 'BoardWithPosition.category_id');
}
}

10
models/Book.php Normal file
View File

@ -0,0 +1,10 @@
<?php
class Book extends Doctrine_Record {
public function setUp() {
$this->ownsMany('Author', 'Author.book_id');
}
public function setTableDefinition() {
$this->hasColumn('user_id', 'integer');
$this->hasColumn('name', 'string',20);
}
}

7
models/BooleanTest.php Normal file
View File

@ -0,0 +1,7 @@
<?php
class BooleanTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('is_working', 'boolean');
$this->hasColumn('is_working_notnull', 'boolean', 1, array('default' => false, 'notnull' => true));
}
}

View File

@ -0,0 +1,7 @@
<?php
class CPK_Association extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('test1_id', 'integer', 11, 'primary');
$this->hasColumn('test2_id', 'integer', 11, 'primary');
}
}

9
models/CPK_Test.php Normal file
View File

@ -0,0 +1,9 @@
<?php
class CPK_Test extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string', 255);
}
public function setUp() {
$this->hasMany('CPK_Test2 as Test', 'CPK_Association.test2_id');
}
}

9
models/CPK_Test2.php Normal file
View File

@ -0,0 +1,9 @@
<?php
class CPK_Test2 extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string', 255);
}
public function setUp() {
$this->hasMany('CPK_Test as Test', 'CPK_Association.test1_id');
}
}

View File

@ -0,0 +1,20 @@
<?php
class CascadeDeleteRelatedTest extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string');
$this->hasColumn('cscd_id', 'integer');
}
public function setUp()
{
$this->hasOne('CascadeDeleteTest', array('local' => 'cscd_id',
'foreign' => 'id',
'onDelete' => 'CASCADE',
'onUpdate' => 'SET NULL'));
$this->hasMany('CascadeDeleteRelatedTest2 as Related',
array('local' => 'id',
'foreign' => 'cscd_id'));
}
}

View File

@ -0,0 +1,15 @@
<?php
class CascadeDeleteRelatedTest2 extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string');
$this->hasColumn('cscd_id', 'integer');
}
public function setUp()
{
$this->hasOne('CascadeDeleteRelatedTest', array('local' => 'cscd_id',
'foreign' => 'id',
'onDelete' => 'SET NULL'));
}
}

View File

@ -0,0 +1,14 @@
<?php
class CascadeDeleteTest extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string');
}
public function setUp()
{
$this->hasMany('CascadeDeleteRelatedTest as Related',
array('local' => 'id',
'foreign' => 'cscd_id'));
}
}

View File

@ -0,0 +1,10 @@
<?php
class CategoryWithPosition extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('position', 'integer');
$this->hasColumn('name', 'string', 255);
}
public function setUp() {
$this->ownsMany('BoardWithPosition as Boards', 'BoardWithPosition.category_id');
}
}

View File

@ -0,0 +1,10 @@
<?php
class CheckConstraintTest extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('price', 'decimal', 2, array('max' => 5000, 'min' => 100));
$this->hasColumn('discounted_price', 'decimal', 2);
$this->check('price > discounted_price');
}
}

21
models/Cms_Cateogry.php Normal file
View File

@ -0,0 +1,21 @@
<?php
class Cms_Category extends Doctrine_Record
{
public function setUp()
{
$this->ownsMany('Cms_CategoryLanguages as langs', array('local' => 'id', 'foreign' => 'category_id'));
}
public function setTableDefinition()
{
$this->hasColumn('created', 'timestamp');
$this->hasColumn('parent', 'integer', 11);
$this->hasColumn('position', 'integer', 3);
$this->hasColumn('active', 'integer', 11);
$this->option('collate', 'utf8_unicode_ci');
$this->option('charset', 'utf8');
$this->option('type', 'INNODB');
$this->index('index_parent', array('fields' => array('parent')));
}
}

View File

@ -19,23 +19,3 @@ class Cms_CategoryLanguages extends Doctrine_Record
$this->index('index_language', array('fields' => array('language_id')));
}
}
class Cms_Category extends Doctrine_Record
{
public function setUp()
{
$this->ownsMany('Cms_CategoryLanguages as langs', array('local' => 'id', 'foreign' => 'category_id'));
}
public function setTableDefinition()
{
$this->hasColumn('created', 'timestamp');
$this->hasColumn('parent', 'integer', 11);
$this->hasColumn('position', 'integer', 3);
$this->hasColumn('active', 'integer', 11);
$this->option('collate', 'utf8_unicode_ci');
$this->option('charset', 'utf8');
$this->option('type', 'INNODB');
$this->index('index_parent', array('fields' => array('parent')));
}
}

View File

@ -0,0 +1,12 @@
<?php
class ColumnAliasTest extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('column1 as alias1', 'string', 200);
$this->hasColumn('column2 as alias2', 'integer', 11);
}
public function setUp()
{
}
}

8
models/ConcreteEmail.php Normal file
View File

@ -0,0 +1,8 @@
<?php
class ConcreteEmail extends Doctrine_Record
{
public function setUp()
{
$this->loadTemplate('EmailTemplate');
}
}

8
models/ConcreteGroup.php Normal file
View File

@ -0,0 +1,8 @@
<?php
class ConcreteGroup extends Doctrine_Record
{
public function setUp()
{
$this->loadTemplate('GroupTemplate');
}
}

View File

@ -0,0 +1,8 @@
<?php
class ConcreteGroupUser extends Doctrine_Record
{
public function setUp()
{
$this->loadTemplate('GroupUserTemplate');
}
}

View File

@ -0,0 +1,18 @@
<?php
class ConcreteInheritanceTestParent extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string');
}
}
class ConcreteInheritanceTestChild extends ConcreteInheritanceTestParent
{
public function setTableDefinition()
{
$this->hasColumn('age', 'integer');
parent::setTableDefinition();
}
}

9
models/ConcreteUser.php Normal file
View File

@ -0,0 +1,9 @@
<?php
class ConcreteUser extends Doctrine_Record
{
public function setUp()
{
$this->loadTemplate('UserTemplate');
}
}

14
models/CoverageCodeN.php Normal file
View File

@ -0,0 +1,14 @@
<?php
class CoverageCodeN extends Doctrine_Record {
public function setTableDefinition(){
$this->setTableName('coverage_codes');
$this->hasColumn('id', 'integer', 4, array('notnull' => true, 'primary' => true, 'autoincrement' => true));
$this->hasColumn('code', 'integer', 4, array ( 'notnull' => true, 'notblank' => true,));
$this->hasColumn('description', 'string', 4000, array ( 'notnull' => true, 'notblank' => true,));
}
public function setUp(){
# $this->index('code', array('fields' => 'code'));
}
}

7
models/CustomPK.php Normal file
View File

@ -0,0 +1,7 @@
<?php
class CustomPK extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('uid', 'integer',11, 'autoincrement|primary');
$this->hasColumn('name', 'string',255);
}
}

View File

@ -0,0 +1,9 @@
<?php
class CustomSequenceRecord extends Doctrine_Record {
public function setTableDefinition()
{
$this->hasColumn('id', 'integer', null, array('primary', 'sequence' => 'custom_seq'));
$this->hasColumn('name', 'string');
}
}

10
models/Data_File.php Normal file
View File

@ -0,0 +1,10 @@
<?php
class Data_File extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('filename', 'string');
$this->hasColumn('file_owner_id', 'integer');
}
public function setUp() {
$this->hasOne('File_Owner', 'Data_File.file_owner_id');
}
}

7
models/DateTest.php Normal file
View File

@ -0,0 +1,7 @@
<?php
class DateTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('date', 'date', 20);
}
}

8
models/Description.php Normal file
View File

@ -0,0 +1,8 @@
<?php
class Description extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('description', 'string',3000);
$this->hasColumn('file_md5', 'string',32);
}
}

12
models/Element.php Normal file
View File

@ -0,0 +1,12 @@
<?php
class Element extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string', 100);
$this->hasColumn('parent_id', 'integer');
}
public function setUp() {
$this->hasMany('Element as Child', 'Child.parent_id');
$this->hasOne('Element as Parent', 'Element.parent_id');
}
}

8
models/Email.php Normal file
View File

@ -0,0 +1,8 @@
<?php
class Email extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('address', 'string', 150, 'email|unique');
}
}

26
models/Entity.php Normal file
View File

@ -0,0 +1,26 @@
<?php
class Entity extends Doctrine_Record
{
public function setUp()
{
$this->ownsOne('Email', array('local' => 'email_id'));
$this->hasMany('Phonenumber', array('local' => 'id', 'foreign' => 'entity_id'));
$this->ownsOne('Account', array('foreign' => 'entity_id'));
$this->hasMany('Entity', array('local' => 'entity1',
'refClass' => 'EntityReference',
'foreign' => 'entity2',
'equal' => true));
}
public function setTableDefinition()
{
$this->hasColumn('id', 'integer',20, 'autoincrement|primary');
$this->hasColumn('name', 'string',50);
$this->hasColumn('loginname', 'string',20, array('unique'));
$this->hasColumn('password', 'string',16);
$this->hasColumn('type', 'integer',1);
$this->hasColumn('created', 'integer',11);
$this->hasColumn('updated', 'integer',11);
$this->hasColumn('email_id', 'integer');
$this->setSubclasses(array("User" => array("type" => 0), "Group" => array("type" => 1)));
}
}

9
models/EntityAddress.php Normal file
View File

@ -0,0 +1,9 @@
<?php
class EntityAddress extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('user_id', 'integer', null, array('primary' => true));
$this->hasColumn('address_id', 'integer', null, array('primary' => true));
}
}

View File

@ -0,0 +1,11 @@
<?php
class EntityReference extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('entity1', 'integer', null, 'primary');
$this->hasColumn('entity2', 'integer', null, 'primary');
//$this->setPrimaryKey(array('entity1', 'entity2'));
}
}

12
models/EnumTest.php Normal file
View File

@ -0,0 +1,12 @@
<?php
class EnumTest extends Doctrine_Record
{
public function setTableDefinition() {
$this->hasColumn('status', 'enum', 11, array('values' => array('open', 'verified', 'closed')));
$this->hasColumn('text', 'string');
}
public function setUp() {
$this->hasMany('EnumTest2 as Enum2', array('local' => 'id', 'foreign' => 'enum_test_id'));
$this->hasMany('EnumTest3 as Enum3', array('local' => 'text', 'foreign' => 'text'));
}
}

8
models/EnumTest2.php Normal file
View File

@ -0,0 +1,8 @@
<?php
class EnumTest2 extends Doctrine_Record
{
public function setTableDefinition() {
$this->hasColumn('status', 'enum', 11, array('values' => array('open', 'verified', 'closed')));
$this->hasColumn('enum_test_id', 'integer');
}
}

7
models/EnumTest3.php Normal file
View File

@ -0,0 +1,7 @@
<?php
class EnumTest3 extends Doctrine_Record
{
public function setTableDefinition() {
$this->hasColumn('text', 'string', 10, array('primary' => true));
}
}

12
models/Error.php Normal file
View File

@ -0,0 +1,12 @@
<?php
class Error extends Doctrine_Record {
public function setUp() {
$this->ownsMany('Description', 'Description.file_md5', 'file_md5');
}
public function setTableDefinition() {
$this->hasColumn('message', 'string',200);
$this->hasColumn('code', 'integer',11);
$this->hasColumn('file_md5', 'string',32, 'primary');
}
}

View File

@ -0,0 +1,21 @@
<?php
class EventListenerChainTest extends Doctrine_Record
{
public function setTableDefinition() {
$this->hasColumn('name', 'string', 100);
}
public function setUp() {
$chain = new Doctrine_EventListener_Chain();
$chain->add(new Doctrine_EventListener_TestA());
$chain->add(new Doctrine_EventListener_TestB());
}
}
class Doctrine_EventListener_TestA extends Doctrine_EventListener
{
}
class Doctrine_EventListener_TestB extends Doctrine_EventListener
{
}

View File

@ -0,0 +1,16 @@
<?php
class EventListenerTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn("name", "string", 100);
$this->hasColumn("password", "string", 8);
}
public function setUp() {
//$this->attribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener_AccessorInvoker());
}
public function getName($name) {
return strtoupper($name);
}
public function setPassword($password) {
return md5($password);
}
}

View File

@ -0,0 +1,9 @@
<?php
class ExpressionTest extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string');
$this->hasColumn('amount', 'integer');
}
}

12
models/FieldNameTest.php Normal file
View File

@ -0,0 +1,12 @@
<?php
class FieldNameTest extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('someColumn', 'string', 200, array('default' => 'some string'));
$this->hasColumn('someEnum', 'enum', 4, array('default' => 'php', 'values' => array('php', 'java', 'python')));
$this->hasColumn('someArray', 'array', 100, array('default' => array()));
$this->hasColumn('someObject', 'object', 200, array('default' => new stdClass));
$this->hasColumn('someInt', 'integer', 20, array('default' => 11));
}
}

9
models/File_Owner.php Normal file
View File

@ -0,0 +1,9 @@
<?php
class File_Owner extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string', 255);
}
public function setUp() {
$this->hasOne('Data_File', 'Data_File.file_owner_id');
}
}

9
models/FilterTest.php Normal file
View File

@ -0,0 +1,9 @@
<?php
class FilterTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string',100);
}
public function setUp() {
$this->ownsMany('FilterTest2 as filtered', 'FilterTest2.test1_id');
}
}

7
models/FilterTest2.php Normal file
View File

@ -0,0 +1,7 @@
<?php
class FilterTest2 extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string',100);
$this->hasColumn('test1_id', 'integer');
}
}

9
models/FooBarRecord.php Normal file
View File

@ -0,0 +1,9 @@
<?php
class FooBarRecord extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('fooId', 'integer', null, array('primary' => true));
$this->hasColumn('barId', 'integer', null, array('primary' => true));
}
}

View File

@ -0,0 +1,9 @@
<?php
class FooForeignlyOwned extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', 200);
$this->hasColumn('fooId', 'integer');
}
}

View File

@ -0,0 +1,12 @@
<?php
class FooForeignlyOwnedWithPk extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', 200);
}
public function setUp()
{
$this->hasOne('FooRecord', array('local' => 'id', 'foreign' => 'id'));
}
}

View File

@ -0,0 +1,9 @@
<?php
class FooLocallyOwned extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', 200);
}
}

View File

@ -1,101 +1,43 @@
<?php
class FooRecord extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('foo');
$this->hasColumn('name', 'string', 200, array('notnull' => true));
$this->hasColumn('parent_id', 'integer');
$this->hasColumn('local_foo', 'integer');
}
public function setUp()
{
$this->hasMany('FooRecord as FooFriend', array('local' => 'foo1',
'foreign' => 'foo2',
'equal' => true,
'refClass' => 'FooReferenceRecord',
));
$this->hasMany('FooRecord as FooParents', array('local' => 'foo1',
'foreign' => 'foo2',
'refClass' => 'FooReferenceRecord',
'onDelete' => 'RESTRICT',
));
$this->hasMany('FooRecord as FooChildren', array('local' => 'foo2',
'foreign' => 'foo1',
'refClass' => 'FooReferenceRecord',
));
$this->hasMany('FooRecord as Children', array('local' => 'id', 'foreign' => 'parent_id'));
$this->hasOne('FooRecord as Parent', array('local' => 'parent_id', 'foreign' => 'id', 'onDelete' => 'CASCADE'));
$this->hasOne('FooForeignlyOwnedWithPk', array('local' => 'id', 'foreign' => 'id', 'constraint' => true));
$this->hasOne('FooLocallyOwned', array('local' => 'local_foo', 'onDelete' => 'RESTRICT'));
$this->hasMany('BarRecord as Bar', array('local' => 'fooId',
'foreign' => 'barId',
'refClass' => 'FooBarRecord',
'onUpdate' => 'RESTRICT'));
}
}
class FooReferenceRecord extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('foo_reference');
$this->hasColumn('foo1', 'integer', null, array('primary' => true));
$this->hasColumn('foo2', 'integer', null, array('primary' => true));
}
}
class FooBarRecord extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('fooId', 'integer', null, array('primary' => true));
$this->hasColumn('barId', 'integer', null, array('primary' => true));
}
}
class BarRecord extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('bar');
$this->hasColumn('name', 'string', 200);
}
public function setUp()
{
$this->hasMany('FooRecord as Foo', array('local' => 'barId', 'foreign' => 'fooId', 'refClass' => 'FooBarRecord'));
}
}
class FooLocallyOwned extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', 200);
}
}
class FooForeignlyOwned extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', 200);
$this->hasColumn('fooId', 'integer');
}
}
class FooForeignlyOwnedWithPk extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', 200);
}
public function setUp()
{
$this->hasOne('FooRecord', array('local' => 'id', 'foreign' => 'id'));
}
}
<?php
class FooRecord extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('foo');
$this->hasColumn('name', 'string', 200, array('notnull' => true));
$this->hasColumn('parent_id', 'integer');
$this->hasColumn('local_foo', 'integer');
}
public function setUp()
{
$this->hasMany('FooRecord as FooFriend', array('local' => 'foo1',
'foreign' => 'foo2',
'equal' => true,
'refClass' => 'FooReferenceRecord',
));
$this->hasMany('FooRecord as FooParents', array('local' => 'foo1',
'foreign' => 'foo2',
'refClass' => 'FooReferenceRecord',
'onDelete' => 'RESTRICT',
));
$this->hasMany('FooRecord as FooChildren', array('local' => 'foo2',
'foreign' => 'foo1',
'refClass' => 'FooReferenceRecord',
));
$this->hasMany('FooRecord as Children', array('local' => 'id', 'foreign' => 'parent_id'));
$this->hasOne('FooRecord as Parent', array('local' => 'parent_id', 'foreign' => 'id', 'onDelete' => 'CASCADE'));
$this->hasOne('FooForeignlyOwnedWithPk', array('local' => 'id', 'foreign' => 'id', 'constraint' => true));
$this->hasOne('FooLocallyOwned', array('local' => 'local_foo', 'onDelete' => 'RESTRICT'));
$this->hasMany('BarRecord as Bar', array('local' => 'fooId',
'foreign' => 'barId',
'refClass' => 'FooBarRecord',
'onUpdate' => 'RESTRICT'));
}
}

View File

@ -0,0 +1,11 @@
<?php
class FooReferenceRecord extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('foo_reference');
$this->hasColumn('foo1', 'integer', null, array('primary' => true));
$this->hasColumn('foo2', 'integer', null, array('primary' => true));
}
}

24
models/ForeignKeyTest.php Normal file
View File

@ -0,0 +1,24 @@
<?php
class ForeignKeyTest extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', null);
$this->hasColumn('code', 'integer', 4);
$this->hasColumn('content', 'string', 4000);
$this->hasColumn('parent_id', 'integer');
$this->hasOne('ForeignKeyTest as Parent',
array('local' => 'parent_id',
'foreign' => 'id',
'onDelete' => 'CASCADE',
'onUpdate' => 'RESTRICT')
);
$this->hasMany('ForeignKeyTest as Children',
'ForeignKeyTest.parent_id');
$this->option('type', 'INNODB');
}
}

View File

@ -0,0 +1,11 @@
<?php
class ForeignKeyTest2 extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', null);
$this->hasColumn('foreignkey', 'integer');
$this->hasOne('ForeignKeyTest', 'ForeignKeyTest2.foreignkey');
}
}

13
models/Forum_Board.php Normal file
View File

@ -0,0 +1,13 @@
<?php
class Forum_Board extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('category_id', 'integer', 10);
$this->hasColumn('name', 'string', 100);
$this->hasColumn('description', 'string', 5000);
}
public function setUp() {
$this->hasOne('Forum_Category as Category', 'Forum_Board.category_id');
$this->ownsMany('Forum_Thread as Threads', 'Forum_Thread.board_id');
}
}

14
models/Forum_Category.php Normal file
View File

@ -0,0 +1,14 @@
<?php
class Forum_Category extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('root_category_id', 'integer', 10);
$this->hasColumn('parent_category_id', 'integer', 10);
$this->hasColumn('name', 'string', 50);
$this->hasColumn('description', 'string', 99999);
}
public function setUp() {
$this->hasMany('Forum_Category as Subcategory', 'Subcategory.parent_category_id');
$this->hasOne('Forum_Category as Parent', 'Forum_Category.parent_category_id');
$this->hasOne('Forum_Category as Rootcategory', 'Forum_Category.root_category_id');
}
}

16
models/Forum_Entry.php Normal file
View File

@ -0,0 +1,16 @@
<?php
class Forum_Entry extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('author', 'string', 50);
$this->hasColumn('topic', 'string', 100);
$this->hasColumn('message', 'string', 99999);
$this->hasColumn('parent_entry_id', 'integer', 10);
$this->hasColumn('thread_id', 'integer', 10);
$this->hasColumn('date', 'integer', 10);
}
public function setUp() {
$this->hasOne('Forum_Entry as Parent', 'Forum_Entry.parent_entry_id');
$this->hasOne('Forum_Thread as Thread', 'Forum_Entry.thread_id');
}
}

13
models/Forum_Thread.php Normal file
View File

@ -0,0 +1,13 @@
<?php
class Forum_Thread extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('board_id', 'integer', 10);
$this->hasColumn('updated', 'integer', 10);
$this->hasColumn('closed', 'integer', 1);
}
public function setUp() {
$this->hasOne('Forum_Board as Board', 'Forum_Thread.board_id');
$this->ownsMany('Forum_Entry as Entries', 'Forum_Entry.thread_id');
}
}

13
models/Group.php Normal file
View File

@ -0,0 +1,13 @@
<?php
// grouptable doesn't extend Doctrine_Table -> Doctrine_Connection
// won't initialize grouptable when Doctrine_Connection->getTable('Group') is called
class GroupTable { }
class Group extends Entity {
public function setUp() {
parent::setUp();
$this->hasMany('User', 'Groupuser.user_id');
// $this->option('inheritanceMap', array('type' => 1));
}
}

10
models/GroupUser.php Normal file
View File

@ -0,0 +1,10 @@
<?php
class Groupuser extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('added', 'integer');
$this->hasColumn('group_id', 'integer');
$this->hasColumn('user_id', 'integer');
}
}

6
models/GzipTest.php Normal file
View File

@ -0,0 +1,6 @@
<?php
class GzipTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('gzip', 'gzip', 100000);
}
}

View File

@ -0,0 +1,19 @@
<?php
class InheritanceTest extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string');
$this->hasColumn('type', 'string');
$this->setSubclasses(array('InheritanceChildTest' => array('type' => 'type 1'),
'InheritanceChild2Test' => array('type' => 'type 2')));
}
}
class InheritanceChildTest extends InheritanceTest
{ }
class InheritanceChild2Test extends InheritanceTest
{ }

8
models/JC1.php Normal file
View File

@ -0,0 +1,8 @@
<?php
class JC1 extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('c1_id', 'integer');
$this->hasColumn('c2_id', 'integer');
}
}

8
models/JC2.php Normal file
View File

@ -0,0 +1,8 @@
<?php
class JC2 extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('c1_id', 'integer');
$this->hasColumn('c2_id', 'integer');
}
}

8
models/JC3.php Normal file
View File

@ -0,0 +1,8 @@
<?php
class JC3 extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('c1_id', 'integer');
$this->hasColumn('c2_id', 'integer');
}
}

14
models/LiabilityCodeN.php Normal file
View File

@ -0,0 +1,14 @@
<?php
class LiabilityCodeN extends Doctrine_Record {
public function setTableDefinition(){
$this->setTableName('liability_codes');
$this->hasColumn('id', 'integer', 4, array('notnull' => true, 'primary' => true, 'autoincrement' => true));
$this->hasColumn('code', 'integer', 4, array ( 'notnull' => true, 'notblank' => true,));
$this->hasColumn('description', 'string', 4000, array ( 'notnull' => true, 'notblank' => true,));
}
public function setUp(){
# $this->index('code', array('fields' => 'code'));
}
}

15
models/LocationI18n.php Normal file
View File

@ -0,0 +1,15 @@
<?php
class LocationI18n extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', 50, array());
$this->hasColumn('id', 'integer', 10, array('primary' => true));
$this->hasColumn('culture', 'string', 2);
}
public function setUp()
{
$this->hasOne('Location as Location', array('local' => 'id'));
}
}

10
models/Log_Entry.php Normal file
View File

@ -0,0 +1,10 @@
<?php
class Log_Entry extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('stamp', 'timestamp');
$this->hasColumn('status_id', 'integer');
}
public function setUp() {
$this->hasOne('Log_Status', 'Log_Entry.status_id');
}
}

6
models/Log_Status.php Normal file
View File

@ -0,0 +1,6 @@
<?php
class Log_Status extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string', 255);
}
}

16
models/M2MTest.php Normal file
View File

@ -0,0 +1,16 @@
<?php
class M2MTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string', 200);
$this->hasColumn('child_id', 'integer');
}
public function setUp() {
$this->hasMany('RTC1 as RTC1', 'JC1.c1_id');
$this->hasMany('RTC2 as RTC2', 'JC1.c1_id');
$this->hasMany('RTC3 as RTC3', 'JC2.c1_id');
$this->hasMany('RTC3 as RTC4', 'JC1.c1_id');
}
}

11
models/M2MTest2.php Normal file
View File

@ -0,0 +1,11 @@
<?php
class M2MTest2 extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('oid', 'integer', 11, array('autoincrement', 'primary'));
$this->hasColumn('name', 'string', 20);
}
public function setUp() {
$this->hasMany('RTC4 as RTC5', 'JC3.c1_id');
}
}

17
models/MyGroup.php Normal file
View File

@ -0,0 +1,17 @@
<?php
class MyGroup extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('my_group');
$this->hasColumn('id', 'integer', 4, array ( 'primary' => true, 'autoincrement' => true,));
$this->hasColumn('name', 'string', 255, array ( 'notnull' => true,));
$this->hasColumn('description', 'string', 4000, array ());
}
public function setUp()
{
$this->hasMany('MyUser as users', array('refClass' => 'MyUserGroup', 'local' => 'group_id', 'foreign' => 'user_id'));
}
}

10
models/MyOneThing.php Normal file
View File

@ -0,0 +1,10 @@
<?php
class MyOneThing extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string');
$this->hasColumn('user_id', 'integer');
}
public function setUp() {
$this->hasMany('MyUserOneThing', 'MyUserOneThing.one_thing_id');
}
}

10
models/MyOtherThing.php Normal file
View File

@ -0,0 +1,10 @@
<?php
class MyOtherThing extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string');
$this->hasColumn('user_id', 'integer');
}
public function setUp() {
$this->hasMany('MyUserOtherThing', 'MyUserOtherThing.other_thing_id');
}
}

10
models/MyUser.php Normal file
View File

@ -0,0 +1,10 @@
<?php
class MyUser extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string');
}
public function setUp() {
$this->hasMany('MyOneThing', 'MyOneThing.user_id');
$this->hasMany('MyOtherThing', 'MyOtherThing.user_id');
}
}

23
models/MyUser2.php Normal file
View File

@ -0,0 +1,23 @@
<?php
class MyUser2 extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('my_user');
$this->hasColumn('id', 'integer', 4, array ( 'primary' => true, 'autoincrement' => true,));
$this->hasColumn('username', 'string', 128, array ( 'notnull' => true,));
$this->hasColumn('algorithm', 'string', 128, array ( 'default' => 'sha1', 'notnull' => true,));
$this->hasColumn('salt', 'string', 128, array ( 'notnull' => true,));
$this->hasColumn('password', 'string', 128, array ( 'notnull' => true,));
$this->hasColumn('created_at', 'timestamp', null, array ());
$this->hasColumn('last_login', 'timestamp', null, array ());
$this->hasColumn('is_active', 'boolean', null, array ( 'default' => 1, 'notnull' => true,));
$this->hasColumn('is_super_admin', 'boolean', null, array ( 'default' => 0, 'notnull' => true,));
}
public function setUp()
{
$this->hasMany('MyGroup as groups', array('refClass' => 'MyUserGroup', 'local' => 'user_id', 'foreign' => 'group_id'));
}
}

18
models/MyUserGroup.php Normal file
View File

@ -0,0 +1,18 @@
<?php
class MyUserGroup extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('my_user_group');
$this->hasColumn('id', 'integer', 4, array ( 'primary' => true, 'autoincrement' => true,));
$this->hasColumn('group_id', 'integer', 4, array ());
$this->hasColumn('user_id', 'integer', 4, array ());
}
public function setUp()
{
$this->hasOne('MyGroup as MyGroup', 'MyUserGroup.group_id');
$this->hasOne('MyUser as MyUser', 'MyUserGroup.user_id');
}
}

View File

@ -0,0 +1,7 @@
<?php
class MyUserOneThing extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('user_id', 'integer');
$this->hasColumn('one_thing_id', 'integer');
}
}

View File

@ -0,0 +1,7 @@
<?php
class MyUserOtherThing extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('user_id', 'integer');
$this->hasColumn('other_thing_id', 'integer');
}
}

10
models/MysqlGroup.php Normal file
View File

@ -0,0 +1,10 @@
<?php
class MysqlGroup extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', null);
$this->hasMany('MysqlUser', 'MysqlGroupMember.user_id');
}
}

View File

@ -0,0 +1,10 @@
<?php
class MysqlGroupMember extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('group_id', 'integer', null, 'primary');
$this->hasColumn('user_id', 'integer', null, 'primary');
}
}

View File

@ -0,0 +1,11 @@
<?php
class MysqlTestRecord extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', null, 'primary');
$this->hasColumn('code', 'integer', null, 'primary');
$this->option('type', 'INNODB');
}
}

10
models/MysqlUser.php Normal file
View File

@ -0,0 +1,10 @@
<?php
class MysqlUser extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', null);
$this->hasMany('MysqlGroup', 'MysqlGroupMember.group_id');
}
}

9
models/NestReference.php Normal file
View File

@ -0,0 +1,9 @@
<?php
class NestReference extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('parent_id', 'integer', 4, 'primary');
$this->hasColumn('child_id', 'integer', 4, 'primary');
}
}

22
models/NestTest.php Normal file
View File

@ -0,0 +1,22 @@
<?php
class NestTest extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string');
}
public function setUp()
{
$this->hasMany('NestTest as Parents', array('local' => 'child_id',
'refClass' => 'NestReference',
'foreign' => 'parent_id'));
$this->hasMany('NestTest as Children', array('local' => 'parent_id',
'refClass' => 'NestReference',
'foreign' => 'child_id'));
$this->hasMany('NestTest as Relatives', array('local' => 'child_id',
'refClass' => 'NestReference',
'foreign' => 'parent_id',
'equal' => true));
}
}

View File

@ -0,0 +1,9 @@
<?php
class NestedSetTest_SingleRootNode extends Doctrine_Record {
public function setTableDefinition() {
$this->actAs('NestedSet');
$this->hasColumn('name', 'string', 50, array('notnull'));
}
}

7
models/NotNullTest.php Normal file
View File

@ -0,0 +1,7 @@
<?php
class NotNullTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string', 100, 'notnull');
$this->hasColumn('type', 'integer', 11);
}
}

View File

@ -0,0 +1,12 @@
<?php
class ORM_AccessControl extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', 255);
}
public function setUp()
{
$this->hasMany('ORM_AccessGroup as accessGroups', 'ORM_AccessControlsGroups.accessGroupID');
}
}

View File

@ -0,0 +1,9 @@
<?php
class ORM_AccessControlsGroups extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('accessControlID', 'integer', 11, array('primary' => true));
$this->hasColumn('accessGroupID', 'integer', 11, array('primary' => true));
}
}

View File

@ -0,0 +1,12 @@
<?php
class ORM_AccessGroup extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', 255);
}
public function setUp()
{
$this->hasMany('ORM_AccessControl as accessControls', 'ORM_AccessControlsGroups.accessControlID');
}
}

15
models/ORM_TestEntry.php Normal file
View File

@ -0,0 +1,15 @@
<?php
class ORM_TestEntry extends Doctrine_Record {
public function setTableDefinition() {
$this->setTableName('test_entries');
$this->hasColumn('id', 'integer', 11, 'autoincrement|primary');
$this->hasColumn('name', 'string', 255);
$this->hasColumn('stamp', 'timestamp');
$this->hasColumn('amount', 'float');
$this->hasColumn('itemID', 'integer');
}
public function setUp() {
$this->hasOne('ORM_TestItem', 'ORM_TestEntry.itemID');
}
}

13
models/ORM_TestItem.php Normal file
View File

@ -0,0 +1,13 @@
<?php
class ORM_TestItem extends Doctrine_Record {
public function setTableDefinition() {
$this->setTableName('test_items');
$this->hasColumn('id', 'integer', 11, 'autoincrement|primary');
$this->hasColumn('name', 'string', 255);
}
public function setUp() {
$this->hasOne('ORM_TestEntry', 'ORM_TestEntry.itemID');
}
}

11
models/Package.php Normal file
View File

@ -0,0 +1,11 @@
<?php
class Package extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('description', 'string', 255);
}
public function setUp()
{
$this->ownsMany('PackageVersion as Version', 'PackageVersion.package_id');
}
}

12
models/PackageVersion.php Normal file
View File

@ -0,0 +1,12 @@
<?php
class PackageVersion extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('package_id', 'integer');
$this->hasColumn('description', 'string', 255);
}
public function setUp()
{
$this->hasOne('Package', 'PackageVersion.package_id');
$this->hasMany('PackageVersionNotes as Note', 'PackageVersionNotes.package_version_id');
}
}

Some files were not shown because too many files have changed in this diff Show More