DDC117Reference.php 1.2KB

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