lib/composer/ProductBundle/src/VisualMedia/ProductBundle/Entity/BaseProduct.php line 28

Open in your IDE?
  1. <?php
  2. /**
  3. * Base Product
  4. *
  5. * @author Vincent van Waasbergen <v.vanwaasbergen@visualmedia.nl>
  6. */
  7. namespace VisualMedia\ProductBundle\Entity;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use VisualMedia\LisaBundle\Component\Interfaces\EntityInterface;
  10. use VisualMedia\LisaBundle\Traits\BlameableTrait;
  11. use VisualMedia\LisaBundle\Traits\AutoIdTrait;
  12. use VisualMedia\LisaBundle\Traits\TimestampableTrait;
  13. use VisualMedia\ProductBundle\Model\BaseProductModel;
  14. use VisualMedia\OrderingBundle\Traits\OrderingTrait;
  15. /**
  16. * Base Product
  17. *
  18. * @ORM\Entity(repositoryClass="VisualMedia\ProductBundle\Manager\BaseProductManager")
  19. * @ORM\Table(name="product")
  20. *
  21. * @ORM\InheritanceType("SINGLE_TABLE")
  22. * @ORM\DiscriminatorColumn(name="discriminator", type="string")
  23. */
  24. class BaseProduct extends BaseProductModel implements EntityInterface
  25. {
  26. use BlameableTrait;
  27. use AutoIdTrait;
  28. use OrderingTrait;
  29. use TimestampableTrait;
  30. /**
  31. * Channels
  32. *
  33. * @ORM\ManyToMany(targetEntity="VisualMedia\TranslationBundle\Entity\BaseChannel")
  34. * @ORM\JoinTable(name="product_channel",
  35. * joinColumns={@ORM\JoinColumn(name="product_id", referencedColumnName="id", onDelete="CASCADE")},
  36. * inverseJoinColumns={@ORM\JoinColumn(name="channel_id", referencedColumnName="id", onDelete="CASCADE")}
  37. * )
  38. */
  39. public $channels;
  40. /**
  41. * Translatable
  42. */
  43. public $title;
  44. public $browserTitle;
  45. public $slug;
  46. public $metaDescription;
  47. public $metaKeywords;
  48. public $htmlContent;
  49. /**
  50. * @ORM\Column(name="product_code", type="string", length=16, nullable=true)
  51. */
  52. public $productCode;
  53. /**
  54. * @ORM\Column(name="price", type="decimal", scale=2, nullable=true)
  55. */
  56. public $price;
  57. /**
  58. * @ORM\Column(name="previous_price", type="decimal", scale=2, nullable=true)
  59. */
  60. public $previousPrice;
  61. /**
  62. * @ORM\Column(name="published", type="boolean", nullable=false)
  63. */
  64. public $published = true;
  65. /**
  66. * @ORM\Column(name="indexable", type="boolean", nullable=false)
  67. */
  68. public $indexable = true;
  69. /**
  70. * @ORM\OneToMany(targetEntity="VisualMedia\ProductBundle\Entity\BaseProductCategoryLink", cascade={"persist", "remove"}, mappedBy="product", orphanRemoval=true)
  71. */
  72. public $categories;
  73. /**
  74. * @ORM\ManyToOne(targetEntity="VisualMedia\ProductBundle\Entity\BaseAttributeSet", cascade={"persist"}, inversedBy="products")
  75. * @ORM\JoinColumn(name="attribute_set_id", referencedColumnName="id", onDelete="SET NULL")
  76. */
  77. public $attributeSet;
  78. /**
  79. * @ORM\OneToMany(targetEntity="VisualMedia\ProductBundle\Entity\BaseAttributeContent", mappedBy="product", cascade={"persist", "remove"}, orphanRemoval=true)
  80. * @ORM\OrderBy({"id"="ASC"})
  81. */
  82. public $attributes;
  83. /**
  84. * @ORM\OneToMany(targetEntity="VisualMedia\ProductBundle\Entity\BaseProductPhoto", mappedBy="product", cascade={"persist", "remove"}, orphanRemoval=true)
  85. * @ORM\OrderBy({"ordering"="ASC"})
  86. */
  87. public $photos;
  88. /**
  89. * @ORM\ManyToOne(targetEntity="VisualMedia\ProductBundle\Entity\BaseProduct", inversedBy="children")
  90. * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
  91. */
  92. public $parent;
  93. /**
  94. * @ORM\OneToMany(targetEntity="VisualMedia\ProductBundle\Entity\BaseProduct", mappedBy="parent", cascade={"persist"})
  95. * @ORM\OrderBy({"ordering"="ASC"})
  96. */
  97. public $children;
  98. /**
  99. * @ORM\OneToMany(targetEntity="VisualMedia\ProductBundle\Entity\BaseProductContent", mappedBy="product", cascade={"persist", "remove"}, orphanRemoval=true)
  100. */
  101. public $contents;
  102. }