2018-03-15 16:04:00 +01:00
|
|
|
<?php
|
|
|
|
|
2018-04-04 17:42:27 +02:00
|
|
|
namespace AppBundle\Entity;
|
2018-03-15 16:04:00 +01:00
|
|
|
|
2018-04-05 15:05:04 +02:00
|
|
|
use AppBundle\Traits\Commentable;
|
|
|
|
use AppBundle\Traits\Sellable;
|
2018-03-15 16:04:00 +01:00
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
|
|
|
/**
|
2018-04-04 17:42:27 +02:00
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductRepository")
|
2018-03-15 16:04:00 +01:00
|
|
|
*/
|
|
|
|
class Product {
|
|
|
|
/**
|
2018-04-17 13:53:29 +02:00
|
|
|
* @ORM\Column(name="id", type="integer")
|
2018-03-15 16:04:00 +01:00
|
|
|
* @ORM\Id
|
2018-04-17 13:53:29 +02:00
|
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
2018-03-15 16:04:00 +01:00
|
|
|
*/
|
|
|
|
private $id;
|
2018-04-20 09:23:44 +02:00
|
|
|
/**
|
|
|
|
* number of items available
|
|
|
|
* @ORM\Column(name="stock_count", type="integer")
|
|
|
|
*/
|
|
|
|
private $stockCount;
|
2018-03-15 16:04:00 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="string", length=100)
|
|
|
|
*/
|
|
|
|
private $name;
|
|
|
|
|
2018-04-05 17:09:06 +02:00
|
|
|
|
|
|
|
/**
|
2018-04-17 16:23:35 +02:00
|
|
|
* @ORM\Column(type="string", length=256, nullable=true)
|
2018-04-05 17:09:06 +02:00
|
|
|
*/
|
|
|
|
private $image;
|
|
|
|
|
2018-03-15 16:04:00 +01:00
|
|
|
/**
|
2018-03-15 16:18:06 +01:00
|
|
|
* @ORM\ManyToOne(targetEntity="ProductCategory", inversedBy="products")
|
2018-03-15 16:04:00 +01:00
|
|
|
*/
|
|
|
|
private $category;
|
2018-03-15 16:18:06 +01:00
|
|
|
/**
|
2018-04-05 15:05:04 +02:00
|
|
|
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="products")
|
2018-03-15 16:18:06 +01:00
|
|
|
*/
|
2018-04-05 15:05:04 +02:00
|
|
|
private $user;
|
|
|
|
|
|
|
|
use Sellable;
|
|
|
|
use Commentable;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2018-04-19 15:00:29 +02:00
|
|
|
* Get id.
|
|
|
|
*
|
|
|
|
* @return int
|
2018-03-15 16:04:00 +01:00
|
|
|
*/
|
|
|
|
public function getId() {
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-04-19 15:00:29 +02:00
|
|
|
* Set name.
|
|
|
|
*
|
|
|
|
* @param string $name
|
|
|
|
*
|
|
|
|
* @return Product
|
2018-03-15 16:04:00 +01:00
|
|
|
*/
|
2018-04-19 15:00:29 +02:00
|
|
|
public function setName( $name ) {
|
|
|
|
$this->name = $name;
|
|
|
|
|
|
|
|
return $this;
|
2018-03-15 16:04:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-04-19 15:00:29 +02:00
|
|
|
* Get name.
|
|
|
|
*
|
|
|
|
* @return string
|
2018-03-15 16:04:00 +01:00
|
|
|
*/
|
|
|
|
public function getName() {
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-04-19 15:00:29 +02:00
|
|
|
* Set image.
|
|
|
|
*
|
|
|
|
* @param string|null $image
|
|
|
|
*
|
|
|
|
* @return Product
|
2018-03-15 16:04:00 +01:00
|
|
|
*/
|
2018-04-19 15:00:29 +02:00
|
|
|
public function setImage( $image = null ) {
|
|
|
|
$this->image = $image;
|
|
|
|
|
|
|
|
return $this;
|
2018-03-15 16:04:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-04-19 15:00:29 +02:00
|
|
|
* Get image.
|
|
|
|
*
|
|
|
|
* @return string|null
|
2018-03-15 16:04:00 +01:00
|
|
|
*/
|
2018-04-19 15:00:29 +02:00
|
|
|
public function getImage() {
|
|
|
|
return $this->image;
|
2018-03-15 16:04:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-04-19 15:00:29 +02:00
|
|
|
* Set category.
|
|
|
|
*
|
|
|
|
* @param \AppBundle\Entity\ProductCategory|null $category
|
|
|
|
*
|
|
|
|
* @return Product
|
2018-03-15 16:04:00 +01:00
|
|
|
*/
|
2018-04-19 15:00:29 +02:00
|
|
|
public function setCategory( \AppBundle\Entity\ProductCategory $category = null ) {
|
|
|
|
$this->category = $category;
|
|
|
|
|
|
|
|
return $this;
|
2018-03-15 16:04:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-04-19 15:00:29 +02:00
|
|
|
* Get category.
|
|
|
|
*
|
|
|
|
* @return \AppBundle\Entity\ProductCategory|null
|
2018-03-15 16:04:00 +01:00
|
|
|
*/
|
|
|
|
public function getCategory() {
|
|
|
|
return $this->category;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-04-19 15:00:29 +02:00
|
|
|
* Set user.
|
|
|
|
*
|
|
|
|
* @param \AppBundle\Entity\User|null $user
|
|
|
|
*
|
|
|
|
* @return Product
|
2018-03-15 16:04:00 +01:00
|
|
|
*/
|
2018-04-19 15:00:29 +02:00
|
|
|
public function setUser( \AppBundle\Entity\User $user = null ) {
|
|
|
|
$this->user = $user;
|
2018-04-05 15:05:04 +02:00
|
|
|
|
2018-04-19 15:00:29 +02:00
|
|
|
return $this;
|
2018-04-05 15:05:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-04-19 15:00:29 +02:00
|
|
|
* Get user.
|
2018-04-05 15:05:04 +02:00
|
|
|
*
|
2018-04-19 15:00:29 +02:00
|
|
|
* @return \AppBundle\Entity\User|null
|
2018-04-05 15:05:04 +02:00
|
|
|
*/
|
2018-04-19 15:00:29 +02:00
|
|
|
public function getUser() {
|
|
|
|
return $this->user;
|
2018-04-05 15:05:04 +02:00
|
|
|
}
|
2018-04-20 09:23:44 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set stockCount.
|
|
|
|
*
|
|
|
|
* @param int $stockCount
|
|
|
|
*
|
|
|
|
* @return Product
|
|
|
|
*/
|
|
|
|
public function setStockCount($stockCount)
|
|
|
|
{
|
|
|
|
$this->stockCount = $stockCount;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get stockCount.
|
|
|
|
*
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function getStockCount()
|
|
|
|
{
|
|
|
|
return $this->stockCount;
|
|
|
|
}
|
2018-03-15 16:04:00 +01:00
|
|
|
}
|