caisse-bliss/src/AppBundle/Entity/ProductCategory.php
2018-04-04 17:42:27 +02:00

99 lines
1.5 KiB
PHP

<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductCategoryRepository")
*/
class ProductCategory {
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=100)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity="Product", mappedBy="category")
*/
private $products;
/**
* @return mixed
*/
public function getProducts() {
return $this->products;
}
/**
* @param mixed $products
*/
public function setProducts( $products ) {
$this->products = $products;
}
/**
* @return mixed
*/
public function getId() {
return $this->id;
}
/**
* @param mixed $id
*/
public function setId( $id ) {
$this->id = $id;
}
/**
* @return mixed
*/
public function getName() {
return $this->name;
}
/**
* @param mixed $name
*/
public function setName( $name ) {
$this->name = $name;
}
/**
* Constructor
*/
public function __construct() {
$this->products = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add product
*
* @param \AppBundle\Entity\Product $product
*
* @return ProductCategory
*/
public function addProduct( \AppBundle\Entity\Product $product ) {
$this->products[] = $product;
return $this;
}
/**
* Remove product
*
* @param \AppBundle\Entity\Product $product
*/
public function removeProduct( \AppBundle\Entity\Product $product ) {
$this->products->removeElement( $product );
}
}