| 1: | <?php |
| 2: | namespace TIC\DemoBundle\Entity; |
| 3: | |
| 4: | use TIC\DormBundle\Base\TICEntity as BaseEntity; |
| 5: | use TIC\DemoBundle\Repository\CrudObjectRepository as EntityRepo; |
| 6: | |
| 7: | use Doctrine\ORM\Mapping as ORM; |
| 8: | use Symfony\Component\Validator\Constraints as Assert; |
| 9: | |
| 10: | /** |
| 11: | * @ORM\Table(name="tic_demo_crud_object") |
| 12: | * @ORM\Entity(repositoryClass=EntityRepo::class) |
| 13: | * @ORM\HasLifecycleCallbacks |
| 14: | */ |
| 15: | class CrudObject extends BaseEntity |
| 16: | { |
| 17: | use \TIC\DormBundle\Traits\EntityTimestampable; // require @ORM\HasLifecycleCallbacks |
| 18: | use \TIC\DormBundle\Traits\EntityEnabled; |
| 19: | |
| 20: | |
| 21: | // --------------------------------------------------------------------- Properties |
| 22: | |
| 23: | /** |
| 24: | * @ORM\Id |
| 25: | * @ORM\GeneratedValue |
| 26: | * @ORM\Column(type="integer") |
| 27: | */ |
| 28: | private $id; |
| 29: | |
| 30: | /** |
| 31: | * @ORM\Column(type="string", length=100) |
| 32: | */ |
| 33: | private $name; |
| 34: | |
| 35: | /** |
| 36: | * @ORM\Column(type="string", length=50, nullable=true) |
| 37: | */ |
| 38: | private $category; |
| 39: | |
| 40: | /** |
| 41: | * @ORM\Column(type="text", nullable=true) |
| 42: | */ |
| 43: | private $description; |
| 44: | |
| 45: | /** |
| 46: | * @ORM\Column(type="text", nullable=true) |
| 47: | */ |
| 48: | private $comment; |
| 49: | |
| 50: | /** |
| 51: | * @ORM\Column(type="smallint", nullable=true) |
| 52: | */ |
| 53: | private $score; |
| 54: | |
| 55: | /** |
| 56: | * @ORM\Column(type="integer") |
| 57: | */ |
| 58: | private $quantity; |
| 59: | |
| 60: | /** |
| 61: | * @ORM\Column(type="decimal", scale=2, precision=6) |
| 62: | */ |
| 63: | private $price; |
| 64: | |
| 65: | /** |
| 66: | * @ORM\Column(type="date") |
| 67: | */ |
| 68: | private $since; |
| 69: | |
| 70: | /** |
| 71: | * @ORM\Column(type="datetime") |
| 72: | */ |
| 73: | private $publishedAt; |
| 74: | |
| 75: | |
| 76: | // --------------------------------------------------------------------- Custom methods |
| 77: | |
| 78: | public function __construct() |
| 79: | { |
| 80: | |
| 81: | } |
| 82: | |
| 83: | public function __toString() |
| 84: | { |
| 85: | return $this->getName(); |
| 86: | } |
| 87: | |
| 88: | |
| 89: | // --------------------------------------------------------------------- Shortcut methods |
| 90: | |
| 91: | |
| 92: | // --------------------------------------------------------------------- Tweaked methods |
| 93: | |
| 94: | |
| 95: | // --------------------------------------------------------------------- Auto-generated |
| 96: | |
| 97: | public function getId(): ?int |
| 98: | { |
| 99: | return $this->id; |
| 100: | } |
| 101: | |
| 102: | public function getName(): ?string |
| 103: | { |
| 104: | return $this->name; |
| 105: | } |
| 106: | |
| 107: | public function setName(string $name): self |
| 108: | { |
| 109: | $this->name = $name; |
| 110: | |
| 111: | return $this; |
| 112: | } |
| 113: | |
| 114: | public function getCategory(): ?string |
| 115: | { |
| 116: | return $this->category; |
| 117: | } |
| 118: | |
| 119: | public function setCategory(?string $category): self |
| 120: | { |
| 121: | $this->category = $category; |
| 122: | |
| 123: | return $this; |
| 124: | } |
| 125: | |
| 126: | public function getDescription(): ?string |
| 127: | { |
| 128: | return $this->description; |
| 129: | } |
| 130: | |
| 131: | public function setDescription(?string $description): self |
| 132: | { |
| 133: | $this->description = $description; |
| 134: | |
| 135: | return $this; |
| 136: | } |
| 137: | |
| 138: | public function getComment(): ?string |
| 139: | { |
| 140: | return $this->comment; |
| 141: | } |
| 142: | |
| 143: | public function setComment(?string $comment): self |
| 144: | { |
| 145: | $this->comment = $comment; |
| 146: | |
| 147: | return $this; |
| 148: | } |
| 149: | |
| 150: | public function getScore(): ?int |
| 151: | { |
| 152: | return $this->score; |
| 153: | } |
| 154: | |
| 155: | public function setScore(?int $score): self |
| 156: | { |
| 157: | $this->score = $score; |
| 158: | |
| 159: | return $this; |
| 160: | } |
| 161: | |
| 162: | public function getQuantity(): ?int |
| 163: | { |
| 164: | return $this->quantity; |
| 165: | } |
| 166: | |
| 167: | public function setQuantity(int $quantity): self |
| 168: | { |
| 169: | $this->quantity = $quantity; |
| 170: | |
| 171: | return $this; |
| 172: | } |
| 173: | |
| 174: | public function getPrice(): ?string |
| 175: | { |
| 176: | return $this->price; |
| 177: | } |
| 178: | |
| 179: | public function setPrice(string $price): self |
| 180: | { |
| 181: | $this->price = $price; |
| 182: | |
| 183: | return $this; |
| 184: | } |
| 185: | |
| 186: | public function getSince(): ?\DateTimeInterface |
| 187: | { |
| 188: | return $this->since; |
| 189: | } |
| 190: | |
| 191: | public function setSince(\DateTimeInterface $since): self |
| 192: | { |
| 193: | $this->since = $since; |
| 194: | |
| 195: | return $this; |
| 196: | } |
| 197: | |
| 198: | public function getPublishedAt(): ?\DateTimeInterface |
| 199: | { |
| 200: | return $this->publishedAt; |
| 201: | } |
| 202: | |
| 203: | public function setPublishedAt(\DateTimeInterface $publishedAt): self |
| 204: | { |
| 205: | $this->publishedAt = $publishedAt; |
| 206: | |
| 207: | return $this; |
| 208: | } |
| 209: | |
| 210: | |
| 211: | } |
| 212: |