ECommerceFeature.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace Doctrine\Tests\Models\ECommerce;
  3. /**
  4. * Describes a product feature.
  5. *
  6. * @author Giorgio Sironi
  7. * @Entity
  8. * @Table(name="ecommerce_features")
  9. */
  10. class ECommerceFeature
  11. {
  12. /**
  13. * @Column(type="integer")
  14. * @Id
  15. * @GeneratedValue
  16. */
  17. private $id;
  18. /**
  19. * @Column(length=50)
  20. */
  21. private $description;
  22. /**
  23. * @ManyToOne(targetEntity="ECommerceProduct", inversedBy="features")
  24. * @JoinColumn(name="product_id", referencedColumnName="id")
  25. */
  26. private $product;
  27. public function getId() {
  28. return $this->id;
  29. }
  30. public function getDescription() {
  31. return $this->description;
  32. }
  33. public function setDescription($description) {
  34. $this->description = $description;
  35. }
  36. public function setProduct(ECommerceProduct $product) {
  37. $this->product = $product;
  38. }
  39. public function removeProduct() {
  40. if ($this->product !== null) {
  41. $product = $this->product;
  42. $this->product = null;
  43. $product->removeFeature($this);
  44. }
  45. }
  46. public function getProduct() {
  47. return $this->product;
  48. }
  49. }