| Total Complexity | 7 |
| Total Lines | 75 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | class Category |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var string |
||
| 21 | * |
||
| 22 | * @Id |
||
| 23 | * @Column(type="string", length=64) |
||
| 24 | */ |
||
| 25 | protected $id; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var string |
||
| 29 | * |
||
| 30 | * @Column(type="string", length=128) |
||
| 31 | */ |
||
| 32 | protected $name; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @var Collection|Product[] |
||
| 36 | * |
||
| 37 | * @OneToMany(targetEntity="Product", mappedBy="category") |
||
| 38 | */ |
||
| 39 | protected $products; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param string $id |
||
| 43 | */ |
||
| 44 | public function __construct(string $id) |
||
| 45 | { |
||
| 46 | $this->id = $id; |
||
| 47 | |||
| 48 | $this->products = new ArrayCollection(); |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return string |
||
| 53 | */ |
||
| 54 | public function getId(): string |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @param string $name |
||
| 61 | */ |
||
| 62 | public function setName(string $name) |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @return string |
||
| 69 | */ |
||
| 70 | public function getName(): string |
||
| 71 | { |
||
| 72 | return $this->name; |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @param Product[] $products |
||
| 77 | */ |
||
| 78 | public function setProducts(array $products) |
||
| 79 | { |
||
| 80 | $this->products->clear(); |
||
| 81 | foreach ($products as $product) { |
||
| 82 | $this->products->add($product); |
||
| 83 | } |
||
| 84 | } |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @return Collection|Product[] |
||
| 88 | */ |
||
| 89 | public function getProducts(): Collection |
||
| 92 | } |
||
| 93 | } |
||
| 94 |