2007-09-02 18:24:49 +04:00
|
|
|
<?php
|
2007-09-05 08:42:02 +04:00
|
|
|
class Book extends Doctrine_Record
|
|
|
|
{
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
$this->hasMany('Author', array('local' => 'id', 'foreign' => 'book_id'));
|
|
|
|
$this->hasOne('User', array('local' => 'user_id',
|
|
|
|
'foreign' => 'id',
|
|
|
|
'onDelete' => 'CASCADE'));
|
2007-09-02 18:24:49 +04:00
|
|
|
}
|
2007-09-05 08:42:02 +04:00
|
|
|
public function setTableDefinition()
|
|
|
|
{
|
2007-09-02 18:24:49 +04:00
|
|
|
$this->hasColumn('user_id', 'integer');
|
|
|
|
$this->hasColumn('name', 'string',20);
|
|
|
|
}
|
|
|
|
}
|