1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/tests_old/models/ForeignKeyTest.php

23 lines
769 B
PHP
Raw Normal View History

<?php
class ForeignKeyTest extends Doctrine_Record
{
public static function initMetadata($class)
{
$class->setColumn('name', 'string', null);
$class->setColumn('code', 'integer', 4);
$class->setColumn('content', 'string', 4000);
$class->setColumn('parent_id', 'integer');
$class->hasOne('ForeignKeyTest as Parent',
array('local' => 'parent_id',
'foreign' => 'id',
'onDelete' => 'CASCADE',
'onUpdate' => 'RESTRICT')
);
$class->hasMany('ForeignKeyTest as Children', array('local' => 'id', 'foreign' => 'parent_id'));
$class->setTableOption('type', 'INNODB');
}
}