Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Shop\ShopBundle\Entity;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * Cart
- *
- * @ORM\Table()
- * @ORM\Entity
- */
- class Cart
- {
- /**
- * @var integer
- *
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var string
- *
- * @ORM\Column(name="name", type="string", length=255)
- */
- private $name;
- /**
- * @ORM\OneToMany(targetEntity="Product", mappedBy="category")
- */
- protected $product;
- public function __construct()
- {
- $this->product = new ArrayCollection();
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set name
- *
- * @param string $name
- * @return Cart
- */
- public function setName($name)
- {
- $this->name = $name;
- return $this;
- }
- /**
- * Get name
- *
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * Add product
- *
- * @param \Shop\ShopBundle\Entity\Product $product
- * @return Cart
- */
- public function addProduct(\Shop\ShopBundle\Entity\Product $product)
- {
- $this->product[] = $product;
- return $this;
- }
- /**
- * Remove product
- *
- * @param \Shop\ShopBundle\Entity\Product $product
- */
- public function removeProduct(\Shop\ShopBundle\Entity\Product $product)
- {
- $this->product->removeElement($product);
- }
- /**
- * Get product
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getProduct()
- {
- return $this->product;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement