Commit e360684d authored by meus's avatar meus

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

parent 7127f12e
<?php
class Account extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('entity_id', 'integer');
$this->hasColumn('amount', 'integer');
}
}
<?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);
}
}
<?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);
}
}
<?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');
}
}
<?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');
}
}
<?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');
}
}
<?php
class Assignment extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('task_id', 'integer');
$this->hasColumn('resource_id', 'integer');
}
}
<?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'));
}
}
<?php
class Author extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('book_id', 'integer');
$this->hasColumn('name', 'string',20);
}
}
<?php
class BadLyNamed__Class extends Doctrine_Record {
public function setTableDefinition() {
}
public function setUp() { }
}
<?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'));
}
}
<?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');
}
}
<?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);
}
}
<?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));
}
}
<?php
class CPK_Association extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('test1_id', 'integer', 11, 'primary');
$this->hasColumn('test2_id', 'integer', 11, 'primary');
}
}
<?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');
}
}
<?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');
}
}
<?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'));
}
}
<?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'));
}
}
<?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'));
}
}
<?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');
}
}
<?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');
}
}
<?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')));
}
}
......@@ -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')));
}
}
<?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()
{
}
}
<?php
class ConcreteEmail extends Doctrine_Record
{
public function setUp()
{
$this->loadTemplate('EmailTemplate');
}
}
<?php
class ConcreteGroup extends Doctrine_Record
{
public function setUp()
{
$this->loadTemplate('GroupTemplate');
}
}
<?php
class ConcreteGroupUser extends Doctrine_Record
{
public function setUp()
{
$this->loadTemplate('GroupUserTemplate');
}
}
<?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();
}
}
<?php
class ConcreteUser extends Doctrine_Record
{
public function setUp()
{
$this->loadTemplate('UserTemplate');
}
}
<?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'));
}
}
<?php
class CustomPK extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('uid', 'integer',11, 'autoincrement|primary');
$this->hasColumn('name', 'string',255);
}
}
<?php
class CustomSequenceRecord extends Doctrine_Record {
public function setTableDefinition()
{
$this->hasColumn('id', 'integer', null, array('primary', 'sequence' => 'custom_seq'));
$this->hasColumn('name', 'string');
}
}
<?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');
}
}
<?php
class DateTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('date', 'date', 20);
}
}
<?php
class Description extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('description', 'string',3000);
$this->hasColumn('file_md5', 'string',32);
}
}
<?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');
}
}
<?php
class Email extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('address', 'string', 150, 'email|unique');
}
}
<?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)));
}
}
<?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));
}
}
<?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'));
}
}
<?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'));
}
}
<?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');
}
}
<?php
class EnumTest3 extends Doctrine_Record
{
public function setTableDefinition() {
$this->hasColumn('text', 'string', 10, array('primary' => true));
}
}
<?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');
}
}
<?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
{
}
<?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);
}
}
<?php
class ExpressionTest extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string');
$this->hasColumn('amount', 'integer');
}
}
<?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));
}
}
<?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');
}
}
<?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');
}
}
<?php
class FilterTest2 extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string',100);
$this->hasColumn('test1_id', 'integer');
}
}
<?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));
}
}
<?php
class FooForeignlyOwned extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', 200);
$this->hasColumn('fooId', 'integer');
}
}
<?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'));
}
}
<?php
class FooLocallyOwned extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', 200);
}
}
......@@ -41,61 +41,3 @@ class FooRecord extends Doctrine_Record
}
}
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 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));
}
}
<?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');
}
}
<?php
class ForeignKeyTest2 extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', null);
$this->hasColumn('foreignkey', 'integer');
$this->hasOne('ForeignKeyTest', 'ForeignKeyTest2.foreignkey');
}
}
<?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');
}
}
<?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');
}
}
<?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');
}
}
<?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');
}
}
<?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));
}
}
<?php
class Groupuser extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('added', 'integer');
$this->hasColumn('group_id', 'integer');
$this->hasColumn('user_id', 'integer');
}
}
<?php
class GzipTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('gzip', 'gzip', 100000);
}
}
<?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
{ }
<?php
class JC1 extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('c1_id', 'integer');
$this->hasColumn('c2_id', 'integer');
}
}
<?php
class JC2 extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('c1_id', 'integer');
$this->hasColumn('c2_id', 'integer');
}
}
<?php
class JC3 extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('c1_id', 'integer');
$this->hasColumn('c2_id', 'integer');
}
}
<?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'));
}
}
<?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'));
}
}
<?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');
}
}
<?php
class Log_Status extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string', 255);
}
}
<?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');
}
}
<?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');
}
}
<?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'));
}
}
<?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');
}
}
<?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');
}
}
<?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');
}
}
<?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'));
}
}
<?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');
}
}
<?php
class MyUserOneThing extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('user_id', 'integer');
$this->hasColumn('one_thing_id', 'integer');
}
}
<?php
class MyUserOtherThing extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('user_id', 'integer');
$this->hasColumn('other_thing_id', 'integer');
}
}
<?php
class MysqlGroup extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', null);
$this->hasMany('MysqlUser', 'MysqlGroupMember.user_id');
}
}
<?php
class MysqlGroupMember extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('group_id', 'integer', null, 'primary');
$this->hasColumn('user_id', 'integer', null, 'primary');
}
}
<?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');
}
}
<?php
class MysqlUser extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', null);
$this->hasMany('MysqlGroup', 'MysqlGroupMember.group_id');
}
}
<?php
class NestReference extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('parent_id', 'integer', 4, 'primary');
$this->hasColumn('child_id', 'integer', 4, 'primary');
}
}
<?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));
}
}
<?php
class NestedSetTest_SingleRootNode extends Doctrine_Record {
public function setTableDefinition() {
$this->actAs('NestedSet');
$this->hasColumn('name', 'string', 50, array('notnull'));
}
}
<?php
class NotNullTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string', 100, 'notnull');
$this->hasColumn('type', 'integer', 11);
}
}
<?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');
}
}
<?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));
}
}
<?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');
}
}
<?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');
}
}
<?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');
}
}
<?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');
}
}
<?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');
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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