LegacyUserReference.php 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace Doctrine\Tests\Models\Legacy;
  3. /**
  4. * @Entity
  5. * @Table(name="legacy_users_reference")
  6. */
  7. class LegacyUserReference
  8. {
  9. /**
  10. * @Id
  11. * @ManyToOne(targetEntity="LegacyUser", inversedBy="_references")
  12. * @JoinColumn(name="iUserIdSource", referencedColumnName="iUserId")
  13. */
  14. private $_source;
  15. /**
  16. * @Id
  17. * @ManyToOne(targetEntity="LegacyUser", inversedBy="_references")
  18. * @JoinColumn(name="iUserIdTarget", referencedColumnName="iUserId")
  19. */
  20. private $_target;
  21. /**
  22. * @column(type="string")
  23. */
  24. private $_description;
  25. /**
  26. * @column(type="datetime")
  27. */
  28. private $_created;
  29. public function __construct($source, $target, $description)
  30. {
  31. $source->addReference($this);
  32. $target->addReference($this);
  33. $this->_source = $source;
  34. $this->_target = $target;
  35. $this->_description = $description;
  36. $this->_created = new \DateTime("now");
  37. }
  38. public function source()
  39. {
  40. return $this->_source;
  41. }
  42. public function target()
  43. {
  44. return $this->_target;
  45. }
  46. public function setDescription($desc)
  47. {
  48. $this->_description = $desc;
  49. }
  50. public function getDescription()
  51. {
  52. return $this->_description;
  53. }
  54. }