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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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-05 17:09:06 +02:00
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getImage() {
|
|
|
|
return $this->image;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param mixed $image
|
|
|
|
*/
|
|
|
|
public function setImage( $image ) {
|
|
|
|
$this->image = $image;
|
|
|
|
}
|
|
|
|
|
2018-04-05 15:05:04 +02:00
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getUser() {
|
|
|
|
return $this->user;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param mixed $user
|
|
|
|
*/
|
|
|
|
public function setUser( $user ) {
|
|
|
|
$this->user = $user;
|
|
|
|
}
|
2018-03-15 16:04:00 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getPrice() {
|
|
|
|
return $this->price;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param mixed $price
|
|
|
|
*/
|
|
|
|
public function setPrice( $price ) {
|
|
|
|
$this->price = $price;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getCategory() {
|
|
|
|
return $this->category;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param ProductCategory $category
|
|
|
|
*/
|
|
|
|
public function setCategory( ProductCategory $category ) {
|
|
|
|
$this->category = $category;
|
|
|
|
}
|
2018-04-05 15:05:04 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*/
|
|
|
|
public function __construct() {
|
|
|
|
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add sellRecord
|
|
|
|
*
|
|
|
|
* @param \AppBundle\Entity\SellRecord $sellRecord
|
|
|
|
*
|
|
|
|
* @return Product
|
|
|
|
*/
|
|
|
|
public function addSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
|
|
|
|
$this->sellRecords[] = $sellRecord;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
2018-03-15 16:04:00 +01:00
|
|
|
}
|