2008-02-09 02:20:35 +03:00
|
|
|
<?php
|
2008-07-21 00:13:24 +04:00
|
|
|
|
|
|
|
#namespace Doctrine::Test::ORM::Models;
|
|
|
|
|
|
|
|
#use Doctrine::ORM::Entity;
|
|
|
|
|
2008-05-14 01:20:34 +04:00
|
|
|
class CmsUser extends Doctrine_Entity
|
2008-02-09 02:20:35 +03:00
|
|
|
{
|
2008-07-21 00:13:24 +04:00
|
|
|
#protected $id;
|
|
|
|
#protected $status;
|
|
|
|
#protected $username;
|
|
|
|
#protected $name;
|
|
|
|
|
|
|
|
public static function initMetadata($mapping)
|
|
|
|
{
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'id',
|
|
|
|
'type' => 'integer',
|
|
|
|
'length' => 4,
|
|
|
|
'id' => true,
|
2008-07-27 23:38:56 +04:00
|
|
|
'idGenerator' => 'auto'
|
2008-07-21 00:13:24 +04:00
|
|
|
));
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'status',
|
|
|
|
'type' => 'string',
|
|
|
|
'length' => 50
|
|
|
|
));
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'username',
|
|
|
|
'type' => 'string',
|
|
|
|
'length' => 255
|
|
|
|
));
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'name',
|
|
|
|
'type' => 'string',
|
|
|
|
'length' => 255
|
|
|
|
));
|
|
|
|
|
2008-08-16 23:40:59 +04:00
|
|
|
/*$mapping->hasMany('CmsPhonenumber as phonenumbers', array(
|
2008-05-06 17:41:22 +04:00
|
|
|
'local' => 'id', 'foreign' => 'user_id'));
|
2008-07-21 00:13:24 +04:00
|
|
|
$mapping->hasMany('CmsArticle as articles', array(
|
2008-08-16 23:40:59 +04:00
|
|
|
'local' => 'id', 'foreign' => 'user_id'));*/
|
|
|
|
|
|
|
|
$mapping->mapOneToMany(array(
|
|
|
|
'fieldName' => 'phonenumbers',
|
|
|
|
'targetEntity' => 'CmsPhonenumber',
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
$mapping->mapOneToMany(array(
|
|
|
|
'fieldName' => 'articles',
|
|
|
|
'targetEntity' => 'CmsArticle',
|
|
|
|
));
|
|
|
|
|
2008-07-21 00:13:24 +04:00
|
|
|
}
|
2008-02-15 03:57:34 +03:00
|
|
|
}
|