CmsAddress.php 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace Doctrine\Tests\Models\CMS;
  3. /**
  4. * CmsAddress
  5. *
  6. * @author Roman S. Borschel
  7. * @Entity
  8. * @Table(name="cms_addresses")
  9. */
  10. class CmsAddress
  11. {
  12. /**
  13. * @Column(type="integer")
  14. * @Id @GeneratedValue
  15. */
  16. public $id;
  17. /**
  18. * @Column(length=50)
  19. */
  20. public $country;
  21. /**
  22. * @Column(length=50)
  23. */
  24. public $zip;
  25. /**
  26. * @Column(length=50)
  27. */
  28. public $city;
  29. /**
  30. * Testfield for Schema Updating Tests.
  31. */
  32. public $street;
  33. /**
  34. * @OneToOne(targetEntity="CmsUser", inversedBy="address")
  35. * @JoinColumn(referencedColumnName="id")
  36. */
  37. public $user;
  38. public function getId() {
  39. return $this->id;
  40. }
  41. public function getUser() {
  42. return $this->user;
  43. }
  44. public function getCountry() {
  45. return $this->country;
  46. }
  47. public function getZipCode() {
  48. return $this->zip;
  49. }
  50. public function getCity() {
  51. return $this->city;
  52. }
  53. public function setUser(CmsUser $user) {
  54. if ($this->user !== $user) {
  55. $this->user = $user;
  56. $user->setAddress($this);
  57. }
  58. }
  59. }