2011-07-28 12:46:38 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\Models\Legacy;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Entity
|
|
|
|
* @Table(name="legacy_users_reference")
|
|
|
|
*/
|
|
|
|
class LegacyUserReference
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @Id
|
2011-07-28 14:25:23 +04:00
|
|
|
* @ManyToOne(targetEntity="LegacyUser", inversedBy="_references")
|
2011-07-28 12:46:38 +04:00
|
|
|
* @JoinColumn(name="iUserIdSource", referencedColumnName="iUserId")
|
|
|
|
*/
|
2011-07-28 14:25:23 +04:00
|
|
|
private $_source;
|
2011-07-28 12:46:38 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @Id
|
2011-07-28 14:25:23 +04:00
|
|
|
* @ManyToOne(targetEntity="LegacyUser", inversedBy="_references")
|
2011-07-28 12:46:38 +04:00
|
|
|
* @JoinColumn(name="iUserIdTarget", referencedColumnName="iUserId")
|
|
|
|
*/
|
2011-07-28 14:25:23 +04:00
|
|
|
private $_target;
|
2011-07-28 12:46:38 +04:00
|
|
|
|
|
|
|
/**
|
2011-10-30 01:58:09 +04:00
|
|
|
* @column(type="string", name="description")
|
2011-07-28 12:46:38 +04:00
|
|
|
*/
|
2011-07-28 14:25:23 +04:00
|
|
|
private $_description;
|
2011-07-28 12:46:38 +04:00
|
|
|
|
|
|
|
/**
|
2011-10-30 01:58:09 +04:00
|
|
|
* @column(type="datetime", name="created")
|
2011-07-28 12:46:38 +04:00
|
|
|
*/
|
2011-07-28 14:25:23 +04:00
|
|
|
private $_created;
|
2011-07-28 12:46:38 +04:00
|
|
|
|
|
|
|
public function __construct($source, $target, $description)
|
|
|
|
{
|
|
|
|
$source->addReference($this);
|
|
|
|
$target->addReference($this);
|
|
|
|
|
2011-07-28 14:25:23 +04:00
|
|
|
$this->_source = $source;
|
|
|
|
$this->_target = $target;
|
|
|
|
$this->_description = $description;
|
|
|
|
$this->_created = new \DateTime("now");
|
2011-07-28 12:46:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
public function source()
|
|
|
|
{
|
2011-07-28 14:25:23 +04:00
|
|
|
return $this->_source;
|
2011-07-28 12:46:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
public function target()
|
|
|
|
{
|
2011-07-28 14:25:23 +04:00
|
|
|
return $this->_target;
|
2011-07-28 12:46:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setDescription($desc)
|
|
|
|
{
|
2011-07-28 14:25:23 +04:00
|
|
|
$this->_description = $desc;
|
2011-07-28 12:46:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getDescription()
|
|
|
|
{
|
2011-07-28 14:25:23 +04:00
|
|
|
return $this->_description;
|
2011-07-28 12:46:38 +04:00
|
|
|
}
|
|
|
|
}
|