@@ -20,60 +20,60 @@ |
||
20 | 20 | new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'), |
21 | 21 | new Put( |
22 | 22 | security: 'is_granted(\'ROLE_CLIENT\')', |
23 | - denormalizationContext: ['groups' => ['product_group_product:write']] |
|
23 | + denormalizationContext: [ 'groups' => [ 'product_group_product:write' ] ] |
|
24 | 24 | ), |
25 | 25 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
26 | 26 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
27 | 27 | new GetCollection(security: 'is_granted(\'PUBLIC_ACCESS\')') |
28 | 28 | ], |
29 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
30 | - normalizationContext: ['groups' => ['product_group_product:read']], |
|
31 | - denormalizationContext: ['groups' => ['product_group_product:write']] |
|
32 | -)] |
|
33 | -#[ApiFilter(OrderFilter::class, properties: ['productGroup.productGroup' => 'ASC', 'product.product' => 'ASC'])] |
|
34 | -#[ORM\Table(name: 'product_group_product')] |
|
35 | -#[ORM\Entity(repositoryClass: ProductGroupProductRepository::class)] |
|
29 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
30 | + normalizationContext: [ 'groups' => [ 'product_group_product:read' ] ], |
|
31 | + denormalizationContext: [ 'groups' => [ 'product_group_product:write' ] ] |
|
32 | +) ] |
|
33 | +#[ApiFilter(OrderFilter::class, properties: [ 'productGroup.productGroup' => 'ASC', 'product.product' => 'ASC' ]) ] |
|
34 | +#[ORM\Table(name: 'product_group_product') ] |
|
35 | +#[ORM\Entity(repositoryClass: ProductGroupProductRepository::class) ] |
|
36 | 36 | class ProductGroupProduct |
37 | 37 | { |
38 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
|
39 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
40 | - #[ORM\Id] |
|
41 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
42 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
38 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'id' => 'exact' ]) ] |
|
39 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
40 | + #[ORM\Id ] |
|
41 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
42 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
43 | 43 | private $id; |
44 | 44 | |
45 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['product' => 'exact'])] |
|
46 | - #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id', nullable: false)] |
|
47 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
48 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
45 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'product' => 'exact' ]) ] |
|
46 | + #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id', nullable: false) ] |
|
47 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
48 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
49 | 49 | private $product; |
50 | 50 | |
51 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productGroup' => 'exact'])] |
|
52 | - #[ORM\JoinColumn(name: 'product_group_id', referencedColumnName: 'id', nullable: true)] |
|
53 | - #[ORM\ManyToOne(targetEntity: ProductGroup::class)] |
|
54 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
51 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productGroup' => 'exact' ]) ] |
|
52 | + #[ORM\JoinColumn(name: 'product_group_id', referencedColumnName: 'id', nullable: true) ] |
|
53 | + #[ORM\ManyToOne(targetEntity: ProductGroup::class) ] |
|
54 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
55 | 55 | private $productGroup; |
56 | 56 | |
57 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productType' => 'exact'])] |
|
58 | - #[ORM\Column(name: 'product_type', type: 'string', columnDefinition: "ENUM('feedstock', 'component', 'package')", nullable: false)] |
|
59 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
57 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productType' => 'exact' ]) ] |
|
58 | + #[ORM\Column(name: 'product_type', type: 'string', columnDefinition: "ENUM('feedstock', 'component', 'package')", nullable: false) ] |
|
59 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
60 | 60 | private $productType; |
61 | 61 | |
62 | - #[ORM\JoinColumn(name: 'product_child_id', referencedColumnName: 'id', nullable: true)] |
|
63 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
64 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
62 | + #[ORM\JoinColumn(name: 'product_child_id', referencedColumnName: 'id', nullable: true) ] |
|
63 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
64 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
65 | 65 | private $productChild; |
66 | 66 | |
67 | - #[ORM\Column(name: 'quantity', type: 'float', precision: 10, scale: 2, nullable: false, options: ['default' => '1.00'])] |
|
68 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
67 | + #[ORM\Column(name: 'quantity', type: 'float', precision: 10, scale: 2, nullable: false, options: [ 'default' => '1.00' ]) ] |
|
68 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
69 | 69 | private $quantity = 0; |
70 | 70 | |
71 | - #[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 2, nullable: false)] |
|
72 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
71 | + #[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 2, nullable: false) ] |
|
72 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
73 | 73 | private $price = 0; |
74 | 74 | |
75 | - #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: ['default' => '1'])] |
|
76 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
75 | + #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: [ 'default' => '1' ]) ] |
|
76 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
77 | 77 | private $active = true; |
78 | 78 | |
79 | 79 | public function getId() |
@@ -16,50 +16,50 @@ |
||
16 | 16 | use ControleOnline\Repository\InventoryRepository; |
17 | 17 | use ControleOnline\Listener\LogListener; |
18 | 18 | |
19 | -#[ORM\Table(name: 'inventory')] |
|
20 | -#[ORM\Index(name: 'people_id', columns: ['people_id'])] |
|
21 | -#[ORM\Entity(repositoryClass: InventoryRepository::class)] |
|
19 | +#[ORM\Table(name: 'inventory') ] |
|
20 | +#[ORM\Index(name: 'people_id', columns: [ 'people_id' ]) ] |
|
21 | +#[ORM\Entity(repositoryClass: InventoryRepository::class) ] |
|
22 | 22 | #[ApiResource( |
23 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => 'text/csv'], |
|
24 | - normalizationContext: ['groups' => ['inventory:read']], |
|
25 | - denormalizationContext: ['groups' => ['inventory:write']], |
|
23 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => 'text/csv' ], |
|
24 | + normalizationContext: [ 'groups' => [ 'inventory:read' ] ], |
|
25 | + denormalizationContext: [ 'groups' => [ 'inventory:write' ] ], |
|
26 | 26 | operations: [ |
27 | 27 | new GetCollection(security: "is_granted('PUBLIC_ACCESS')"), |
28 | 28 | new Get(security: "is_granted('PUBLIC_ACCESS')"), |
29 | 29 | new Post(securityPostDenormalize: "is_granted('ROLE_CLIENT')"), |
30 | 30 | new Put( |
31 | 31 | security: "is_granted('ROLE_CLIENT')", |
32 | - denormalizationContext: ['groups' => ['inventory:write']] |
|
32 | + denormalizationContext: [ 'groups' => [ 'inventory:write' ] ] |
|
33 | 33 | ), |
34 | 34 | new Delete(security: "is_granted('ROLE_CLIENT')") |
35 | 35 | ] |
36 | -)] |
|
37 | -#[ApiFilter(OrderFilter::class, properties: ['inventory', 'type'])] |
|
36 | +) ] |
|
37 | +#[ApiFilter(OrderFilter::class, properties: [ 'inventory', 'type' ]) ] |
|
38 | 38 | #[ApiFilter(SearchFilter::class, properties: [ |
39 | 39 | 'id' => 'exact', |
40 | 40 | 'inventory' => 'partial', |
41 | 41 | 'type' => 'exact', |
42 | 42 | 'people' => 'exact' |
43 | -])] |
|
43 | +]) ] |
|
44 | 44 | class Inventory |
45 | 45 | { |
46 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
47 | - #[ORM\Id] |
|
48 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
49 | - #[Groups(['inventory:read', 'inventory:write'])] |
|
46 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
47 | + #[ORM\Id ] |
|
48 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
49 | + #[Groups([ 'inventory:read', 'inventory:write' ]) ] |
|
50 | 50 | private $id; |
51 | 51 | |
52 | - #[ORM\Column(name: 'inventory', type: 'string', length: 255, nullable: false)] |
|
53 | - #[Groups(['inventory:read', 'inventory:write'])] |
|
52 | + #[ORM\Column(name: 'inventory', type: 'string', length: 255, nullable: false) ] |
|
53 | + #[Groups([ 'inventory:read', 'inventory:write' ]) ] |
|
54 | 54 | private $inventory; |
55 | 55 | |
56 | - #[ORM\Column(name: 'type', type: 'string', length: 50, nullable: false)] |
|
57 | - #[Groups(['inventory:read', 'inventory:write'])] |
|
56 | + #[ORM\Column(name: 'type', type: 'string', length: 50, nullable: false) ] |
|
57 | + #[Groups([ 'inventory:read', 'inventory:write' ]) ] |
|
58 | 58 | private $type; |
59 | 59 | |
60 | - #[ORM\ManyToOne(targetEntity: People::class)] |
|
61 | - #[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id', nullable: false)] |
|
62 | - #[Groups(['inventory:read', 'inventory:write'])] |
|
60 | + #[ORM\ManyToOne(targetEntity: People::class) ] |
|
61 | + #[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id', nullable: false) ] |
|
62 | + #[Groups([ 'inventory:read', 'inventory:write' ]) ] |
|
63 | 63 | private $people; |
64 | 64 | |
65 | 65 | public function getId(): ?int |
@@ -15,31 +15,31 @@ |
||
15 | 15 | #[ApiResource( |
16 | 16 | operations: [ |
17 | 17 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
18 | - new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product_unity_edit']]), |
|
18 | + new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product_unity_edit' ] ]), |
|
19 | 19 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
20 | 20 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
21 | 21 | new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
22 | 22 | ], |
23 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
24 | - normalizationContext: ['groups' => ['product_unity:read']], |
|
25 | - denormalizationContext: ['groups' => ['product_unity:write']] |
|
26 | -)] |
|
27 | -#[ORM\Table(name: 'product_unity')] |
|
28 | -#[ORM\Entity(repositoryClass: ProductUnityRepository::class)] |
|
23 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
24 | + normalizationContext: [ 'groups' => [ 'product_unity:read' ] ], |
|
25 | + denormalizationContext: [ 'groups' => [ 'product_unity:write' ] ] |
|
26 | +) ] |
|
27 | +#[ORM\Table(name: 'product_unity') ] |
|
28 | +#[ORM\Entity(repositoryClass: ProductUnityRepository::class) ] |
|
29 | 29 | class ProductUnity |
30 | 30 | { |
31 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
32 | - #[ORM\Id] |
|
33 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
34 | - #[ApiResource(normalizationContext: ['groups' => ['product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read']])] |
|
31 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
32 | + #[ORM\Id ] |
|
33 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
34 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read' ] ]) ] |
|
35 | 35 | private $id; |
36 | 36 | |
37 | - #[ORM\Column(name: 'product_unit', type: 'string', length: 3, nullable: false)] |
|
38 | - #[ApiResource(normalizationContext: ['groups' => ['product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read']])] |
|
37 | + #[ORM\Column(name: 'product_unit', type: 'string', length: 3, nullable: false) ] |
|
38 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read' ] ]) ] |
|
39 | 39 | private $productUnit; |
40 | 40 | |
41 | - #[ORM\Column(name: 'unit_type', type: 'string', length: 0, nullable: false, options: ['default' => "'I'", 'comment' => 'Integer, Fractioned'])] |
|
42 | - #[ApiResource(normalizationContext: ['groups' => ['product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read']])] |
|
41 | + #[ORM\Column(name: 'unit_type', type: 'string', length: 0, nullable: false, options: [ 'default' => "'I'", 'comment' => 'Integer, Fractioned' ]) ] |
|
42 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read' ] ]) ] |
|
43 | 43 | private $unitType = 'I'; |
44 | 44 | |
45 | 45 | public function getId() |
@@ -22,66 +22,66 @@ discard block |
||
22 | 22 | new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'), |
23 | 23 | new Put( |
24 | 24 | security: 'is_granted(\'ROLE_CLIENT\')', |
25 | - denormalizationContext: ['groups' => ['product_group:write']] |
|
25 | + denormalizationContext: [ 'groups' => [ 'product_group:write' ] ] |
|
26 | 26 | ), |
27 | 27 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
28 | 28 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
29 | 29 | new GetCollection(security: 'is_granted(\'PUBLIC_ACCESS\')') |
30 | 30 | ], |
31 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
32 | - normalizationContext: ['groups' => ['product_group:read']], |
|
33 | - denormalizationContext: ['groups' => ['product_group:write']] |
|
34 | -)] |
|
35 | -#[ApiFilter(OrderFilter::class, properties: ['productGroup'])] |
|
36 | -#[ORM\Table(name: 'product_group')] |
|
37 | -#[ORM\Entity(repositoryClass: ProductGroupRepository::class)] |
|
31 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
32 | + normalizationContext: [ 'groups' => [ 'product_group:read' ] ], |
|
33 | + denormalizationContext: [ 'groups' => [ 'product_group:write' ] ] |
|
34 | +) ] |
|
35 | +#[ApiFilter(OrderFilter::class, properties: [ 'productGroup' ]) ] |
|
36 | +#[ORM\Table(name: 'product_group') ] |
|
37 | +#[ORM\Entity(repositoryClass: ProductGroupRepository::class) ] |
|
38 | 38 | class ProductGroup |
39 | 39 | { |
40 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
|
41 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
42 | - #[ORM\Id] |
|
43 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
44 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
40 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'id' => 'exact' ]) ] |
|
41 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
42 | + #[ORM\Id ] |
|
43 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
44 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
45 | 45 | private $id; |
46 | 46 | |
47 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productGroup' => 'exact'])] |
|
48 | - #[ORM\Column(name: 'product_group', type: 'string', length: 255, nullable: false)] |
|
49 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
47 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productGroup' => 'exact' ]) ] |
|
48 | + #[ORM\Column(name: 'product_group', type: 'string', length: 255, nullable: false) ] |
|
49 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
50 | 50 | private $productGroup; |
51 | 51 | |
52 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['priceCalculation' => 'exact'])] |
|
53 | - #[ORM\Column(name: 'price_calculation', type: 'string', length: 0, nullable: false, options: ['default' => "'sum'"])] |
|
54 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
52 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'priceCalculation' => 'exact' ]) ] |
|
53 | + #[ORM\Column(name: 'price_calculation', type: 'string', length: 0, nullable: false, options: [ 'default' => "'sum'" ]) ] |
|
54 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
55 | 55 | private $priceCalculation = 'sum'; |
56 | 56 | |
57 | - #[ORM\Column(name: 'required', type: 'boolean', nullable: false)] |
|
58 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
57 | + #[ORM\Column(name: 'required', type: 'boolean', nullable: false) ] |
|
58 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
59 | 59 | private $required = false; |
60 | 60 | |
61 | - #[ORM\Column(name: 'minimum', type: 'integer', nullable: true, options: ['default' => 'NULL'])] |
|
62 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
61 | + #[ORM\Column(name: 'minimum', type: 'integer', nullable: true, options: [ 'default' => 'NULL' ]) ] |
|
62 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
63 | 63 | private $minimum = null; |
64 | 64 | |
65 | - #[ORM\Column(name: 'maximum', type: 'integer', nullable: true, options: ['default' => 'NULL'])] |
|
66 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
65 | + #[ORM\Column(name: 'maximum', type: 'integer', nullable: true, options: [ 'default' => 'NULL' ]) ] |
|
66 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
67 | 67 | private $maximum = null; |
68 | 68 | |
69 | - #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: ['default' => '1'])] |
|
70 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
69 | + #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: [ 'default' => '1' ]) ] |
|
70 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
71 | 71 | private $active = true; |
72 | 72 | |
73 | - #[ORM\Column(name: 'group_order', type: 'integer', nullable: false)] |
|
74 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
73 | + #[ORM\Column(name: 'group_order', type: 'integer', nullable: false) ] |
|
74 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
75 | 75 | private $groupOrder = 0; |
76 | 76 | |
77 | - #[ORM\OneToMany(targetEntity: ProductGroupProduct::class, mappedBy: 'productGroup', orphanRemoval: true)] |
|
78 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:write']])] |
|
77 | + #[ORM\OneToMany(targetEntity: ProductGroupProduct::class, mappedBy: 'productGroup', orphanRemoval: true) ] |
|
78 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:write' ] ]) ] |
|
79 | 79 | private $products; |
80 | 80 | |
81 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productParent' => 'exact'])] |
|
82 | - #[ORM\JoinColumn(nullable: false)] |
|
83 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
84 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write']])] |
|
81 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productParent' => 'exact' ]) ] |
|
82 | + #[ORM\JoinColumn(nullable: false) ] |
|
83 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
84 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write' ] ]) ] |
|
85 | 85 | private $productParent; |
86 | 86 | |
87 | 87 | public function __construct() |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | public function addProduct(ProductGroupProduct $product): self |
190 | 190 | { |
191 | 191 | if (!$this->products->contains($product)) { |
192 | - $this->products[] = $product; |
|
192 | + $this->products[ ] = $product; |
|
193 | 193 | $product->setProductGroup($this); |
194 | 194 | } |
195 | 195 | return $this; |
@@ -19,38 +19,38 @@ |
||
19 | 19 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
20 | 20 | new Put( |
21 | 21 | security: 'is_granted(\'ROLE_CLIENT\')', |
22 | - denormalizationContext: ['groups' => ['product_file:write']] |
|
22 | + denormalizationContext: [ 'groups' => [ 'product_file:write' ] ] |
|
23 | 23 | ), |
24 | 24 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
25 | 25 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
26 | 26 | new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
27 | 27 | ], |
28 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
29 | - normalizationContext: ['groups' => ['product_file:read']], |
|
30 | - denormalizationContext: ['groups' => ['product_file:write']] |
|
31 | -)] |
|
32 | -#[ApiFilter(filterClass: SearchFilter::class, properties: ['file' => 'exact', 'file.fileType' => 'exact', 'product' => 'exact'])] |
|
33 | -#[ORM\Table(name: 'product_file')] |
|
34 | -#[ORM\Index(name: 'file_id', columns: ['file_id'])] |
|
35 | -#[ORM\Index(name: 'IDX_CDFC73564584665B', columns: ['product_id'])] |
|
36 | -#[ORM\UniqueConstraint(name: 'product_id', columns: ['product_id', 'file_id'])] |
|
37 | -#[ORM\Entity(repositoryClass: ProductFileRepository::class)] |
|
28 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
29 | + normalizationContext: [ 'groups' => [ 'product_file:read' ] ], |
|
30 | + denormalizationContext: [ 'groups' => [ 'product_file:write' ] ] |
|
31 | +) ] |
|
32 | +#[ApiFilter(filterClass: SearchFilter::class, properties: [ 'file' => 'exact', 'file.fileType' => 'exact', 'product' => 'exact' ]) ] |
|
33 | +#[ORM\Table(name: 'product_file') ] |
|
34 | +#[ORM\Index(name: 'file_id', columns: [ 'file_id' ]) ] |
|
35 | +#[ORM\Index(name: 'IDX_CDFC73564584665B', columns: [ 'product_id' ]) ] |
|
36 | +#[ORM\UniqueConstraint(name: 'product_id', columns: [ 'product_id', 'file_id' ]) ] |
|
37 | +#[ORM\Entity(repositoryClass: ProductFileRepository::class) ] |
|
38 | 38 | class ProductFile |
39 | 39 | { |
40 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
41 | - #[ORM\Id] |
|
42 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
43 | - #[Groups(['product:read', 'order_product:read', 'product_file:read', 'product_category:read'])] |
|
40 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
41 | + #[ORM\Id ] |
|
42 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
43 | + #[Groups([ 'product:read', 'order_product:read', 'product_file:read', 'product_category:read' ]) ] |
|
44 | 44 | private int $id; |
45 | 45 | |
46 | - #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id')] |
|
47 | - #[ORM\ManyToOne(targetEntity: File::class)] |
|
48 | - #[Groups(['product:read', 'order_product:read', 'product_file:read', 'product_file:write', 'product_category:read'])] |
|
46 | + #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id') ] |
|
47 | + #[ORM\ManyToOne(targetEntity: File::class) ] |
|
48 | + #[Groups([ 'product:read', 'order_product:read', 'product_file:read', 'product_file:write', 'product_category:read' ]) ] |
|
49 | 49 | private File $file; |
50 | 50 | |
51 | - #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id')] |
|
52 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
53 | - #[Groups(['product_file:read', 'product_file:write'])] |
|
51 | + #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id') ] |
|
52 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
53 | + #[Groups([ 'product_file:read', 'product_file:write' ]) ] |
|
54 | 54 | private Product $product; |
55 | 55 | |
56 | 56 | public function getId(): int |
@@ -20,39 +20,39 @@ |
||
20 | 20 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
21 | 21 | new Put( |
22 | 22 | security: 'is_granted(\'ROLE_CLIENT\')', |
23 | - denormalizationContext: ['groups' => ['product_category:write']] |
|
23 | + denormalizationContext: [ 'groups' => [ 'product_category:write' ] ] |
|
24 | 24 | ), |
25 | 25 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
26 | 26 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
27 | 27 | new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
28 | 28 | ], |
29 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
30 | - normalizationContext: ['groups' => ['product_category:read']], |
|
31 | - denormalizationContext: ['groups' => ['product_category:write']] |
|
32 | -)] |
|
33 | -#[ApiFilter(OrderFilter::class, properties: ['product.product'])] |
|
34 | -#[ApiFilter(filterClass: SearchFilter::class, properties: ['category' => 'exact', 'category.company' => 'exact', 'category.context' => 'exact', 'product' => 'exact'])] |
|
35 | -#[ORM\Table(name: 'product_category')] |
|
36 | -#[ORM\Index(name: 'category_id', columns: ['category_id'])] |
|
37 | -#[ORM\Index(name: 'IDX_CDFC73564584665A', columns: ['product_id'])] |
|
38 | -#[ORM\UniqueConstraint(name: 'product_id', columns: ['product_id', 'category_id'])] |
|
39 | -#[ORM\Entity(repositoryClass: ProductCategoryRepository::class)] |
|
29 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
30 | + normalizationContext: [ 'groups' => [ 'product_category:read' ] ], |
|
31 | + denormalizationContext: [ 'groups' => [ 'product_category:write' ] ] |
|
32 | +) ] |
|
33 | +#[ApiFilter(OrderFilter::class, properties: [ 'product.product' ]) ] |
|
34 | +#[ApiFilter(filterClass: SearchFilter::class, properties: [ 'category' => 'exact', 'category.company' => 'exact', 'category.context' => 'exact', 'product' => 'exact' ]) ] |
|
35 | +#[ORM\Table(name: 'product_category') ] |
|
36 | +#[ORM\Index(name: 'category_id', columns: [ 'category_id' ]) ] |
|
37 | +#[ORM\Index(name: 'IDX_CDFC73564584665A', columns: [ 'product_id' ]) ] |
|
38 | +#[ORM\UniqueConstraint(name: 'product_id', columns: [ 'product_id', 'category_id' ]) ] |
|
39 | +#[ORM\Entity(repositoryClass: ProductCategoryRepository::class) ] |
|
40 | 40 | class ProductCategory |
41 | 41 | { |
42 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
43 | - #[ORM\Id] |
|
44 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
45 | - #[Groups(['product_category:read'])] |
|
42 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
43 | + #[ORM\Id ] |
|
44 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
45 | + #[Groups([ 'product_category:read' ]) ] |
|
46 | 46 | private int $id; |
47 | 47 | |
48 | - #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id')] |
|
49 | - #[ORM\ManyToOne(targetEntity: Category::class)] |
|
50 | - #[Groups(['product_category:read', 'product_category:write'])] |
|
48 | + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id') ] |
|
49 | + #[ORM\ManyToOne(targetEntity: Category::class) ] |
|
50 | + #[Groups([ 'product_category:read', 'product_category:write' ]) ] |
|
51 | 51 | private Category $category; |
52 | 52 | |
53 | - #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id')] |
|
54 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
55 | - #[Groups(['product_category:read', 'product_category:write'])] |
|
53 | + #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id') ] |
|
54 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
55 | + #[Groups([ 'product_category:read', 'product_category:write' ]) ] |
|
56 | 56 | private Product $product; |
57 | 57 | |
58 | 58 | public function getId(): int |
@@ -22,107 +22,107 @@ |
||
22 | 22 | #[ApiResource( |
23 | 23 | operations: [ |
24 | 24 | new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'), |
25 | - new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product:write']]), |
|
25 | + new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product:write' ] ]), |
|
26 | 26 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
27 | 27 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
28 | 28 | new GetCollection(security: 'is_granted(\'PUBLIC_ACCESS\')'), |
29 | 29 | ], |
30 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
31 | - normalizationContext: ['groups' => ['product:read']], |
|
32 | - denormalizationContext: ['groups' => ['product:write']] |
|
33 | -)] |
|
34 | -#[ApiFilter(OrderFilter::class, properties: ['product', 'price', 'description'])] |
|
35 | -#[ApiFilter(RandomOrderFilter::class)] |
|
36 | -#[ORM\Table(name: 'product')] |
|
37 | -#[ORM\Index(name: 'product_unity_id', columns: ['product_unity_id'])] |
|
38 | -#[ORM\Index(name: 'IDX_D34A04AD979B1AD6', columns: ['company_id'])] |
|
39 | -#[ORM\Index(name: 'default_out_inventory_id', columns: ['default_out_inventory_id'])] |
|
40 | -#[ORM\Index(name: 'default_in_inventory_id', columns: ['default_in_inventory_id'])] |
|
41 | -#[ORM\UniqueConstraint(name: 'company_id', columns: ['company_id', 'sku'])] |
|
42 | -#[ORM\Entity(repositoryClass: ProductRepository::class)] |
|
30 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
31 | + normalizationContext: [ 'groups' => [ 'product:read' ] ], |
|
32 | + denormalizationContext: [ 'groups' => [ 'product:write' ] ] |
|
33 | +) ] |
|
34 | +#[ApiFilter(OrderFilter::class, properties: [ 'product', 'price', 'description' ]) ] |
|
35 | +#[ApiFilter(RandomOrderFilter::class) ] |
|
36 | +#[ORM\Table(name: 'product') ] |
|
37 | +#[ORM\Index(name: 'product_unity_id', columns: [ 'product_unity_id' ]) ] |
|
38 | +#[ORM\Index(name: 'IDX_D34A04AD979B1AD6', columns: [ 'company_id' ]) ] |
|
39 | +#[ORM\Index(name: 'default_out_inventory_id', columns: [ 'default_out_inventory_id' ]) ] |
|
40 | +#[ORM\Index(name: 'default_in_inventory_id', columns: [ 'default_in_inventory_id' ]) ] |
|
41 | +#[ORM\UniqueConstraint(name: 'company_id', columns: [ 'company_id', 'sku' ]) ] |
|
42 | +#[ORM\Entity(repositoryClass: ProductRepository::class) ] |
|
43 | 43 | class Product |
44 | 44 | { |
45 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
|
46 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
47 | - #[ORM\Id] |
|
48 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
49 | - #[ApiResource(normalizationContext: ['groups' => ['product_category:read', 'product:read', 'order_product:read']])] |
|
45 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'id' => 'exact' ]) ] |
|
46 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
47 | + #[ORM\Id ] |
|
48 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
49 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_category:read', 'product:read', 'order_product:read' ] ]) ] |
|
50 | 50 | private $id; |
51 | 51 | |
52 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['product' => 'partial'])] |
|
53 | - #[ORM\Column(name: 'product', type: 'string', length: 255, nullable: true)] |
|
54 | - #[ApiResource(normalizationContext: ['groups' => ['product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write']])] |
|
52 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'product' => 'partial' ]) ] |
|
53 | + #[ORM\Column(name: 'product', type: 'string', length: 255, nullable: true) ] |
|
54 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write' ] ]) ] |
|
55 | 55 | private $product; |
56 | 56 | |
57 | - #[ApiFilter(filterClass: ExistsFilter::class, properties: ['productFiles'])] |
|
58 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productFiles.file.fileType' => 'exact'])] |
|
59 | - #[ORM\OneToMany(targetEntity: ProductFile::class, mappedBy: 'product')] |
|
60 | - #[ApiResource(normalizationContext: ['groups' => ['product:read', 'product_category:read', 'order_product:read']])] |
|
57 | + #[ApiFilter(filterClass: ExistsFilter::class, properties: [ 'productFiles' ]) ] |
|
58 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productFiles.file.fileType' => 'exact' ]) ] |
|
59 | + #[ORM\OneToMany(targetEntity: ProductFile::class, mappedBy: 'product') ] |
|
60 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product:read', 'product_category:read', 'order_product:read' ] ]) ] |
|
61 | 61 | private $productFiles; |
62 | 62 | |
63 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productCategory.category' => 'exact'])] |
|
64 | - #[ORM\OneToMany(targetEntity: ProductCategory::class, mappedBy: 'product')] |
|
63 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productCategory.category' => 'exact' ]) ] |
|
64 | + #[ORM\OneToMany(targetEntity: ProductCategory::class, mappedBy: 'product') ] |
|
65 | 65 | private $productCategory; |
66 | 66 | |
67 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['sku' => 'partial'])] |
|
68 | - #[ORM\Column(name: 'sku', type: 'string', length: 32, nullable: true, options: ['default' => 'NULL'])] |
|
69 | - #[ApiResource(normalizationContext: ['groups' => ['product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write']])] |
|
67 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'sku' => 'partial' ]) ] |
|
68 | + #[ORM\Column(name: 'sku', type: 'string', length: 32, nullable: true, options: [ 'default' => 'NULL' ]) ] |
|
69 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write' ] ]) ] |
|
70 | 70 | private $sku = null; |
71 | 71 | |
72 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['type' => 'exact'])] |
|
73 | - #[ORM\Column(name: 'type', type: 'string', length: 0, nullable: false, options: ['default' => "'product'"])] |
|
74 | - #[ApiResource(normalizationContext: ['groups' => ['product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write']])] |
|
72 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'type' => 'exact' ]) ] |
|
73 | + #[ORM\Column(name: 'type', type: 'string', length: 0, nullable: false, options: [ 'default' => "'product'" ]) ] |
|
74 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write' ] ]) ] |
|
75 | 75 | private $type = 'product'; |
76 | 76 | |
77 | - #[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 0, nullable: false)] |
|
78 | - #[ApiResource(normalizationContext: ['groups' => ['product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write']])] |
|
77 | + #[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 0, nullable: false) ] |
|
78 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write' ] ]) ] |
|
79 | 79 | private $price = 0; |
80 | 80 | |
81 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productCondition' => 'exact'])] |
|
82 | - #[ORM\Column(name: 'product_condition', type: 'string', length: 0, nullable: false, options: ['default' => "'new'"])] |
|
83 | - #[ApiResource(normalizationContext: ['groups' => ['product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write']])] |
|
81 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productCondition' => 'exact' ]) ] |
|
82 | + #[ORM\Column(name: 'product_condition', type: 'string', length: 0, nullable: false, options: [ 'default' => "'new'" ]) ] |
|
83 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write' ] ]) ] |
|
84 | 84 | private $productCondition = 'new'; |
85 | 85 | |
86 | - #[ORM\Column(name: 'description', type: 'string', length: 0, nullable: false)] |
|
87 | - #[ApiResource(normalizationContext: ['groups' => ['product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write']])] |
|
86 | + #[ORM\Column(name: 'description', type: 'string', length: 0, nullable: false) ] |
|
87 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write' ] ]) ] |
|
88 | 88 | private $description = ''; |
89 | 89 | |
90 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['featured' => 'exact'])] |
|
91 | - #[ORM\Column(name: 'featured', type: 'boolean', nullable: false, options: ['default' => '0'])] |
|
92 | - #[ApiResource(normalizationContext: ['groups' => ['product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write']])] |
|
90 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'featured' => 'exact' ]) ] |
|
91 | + #[ORM\Column(name: 'featured', type: 'boolean', nullable: false, options: [ 'default' => '0' ]) ] |
|
92 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write' ] ]) ] |
|
93 | 93 | private $featured = false; |
94 | 94 | |
95 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['active' => 'exact'])] |
|
96 | - #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: ['default' => '1'])] |
|
97 | - #[ApiResource(normalizationContext: ['groups' => ['product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write']])] |
|
95 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'active' => 'exact' ]) ] |
|
96 | + #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: [ 'default' => '1' ]) ] |
|
97 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write' ] ]) ] |
|
98 | 98 | private $active = true; |
99 | 99 | |
100 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['company' => 'exact'])] |
|
101 | - #[ORM\JoinColumn(name: 'company_id', referencedColumnName: 'id')] |
|
102 | - #[ORM\ManyToOne(targetEntity: People::class)] |
|
103 | - #[ApiResource(normalizationContext: ['groups' => ['product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write']])] |
|
100 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'company' => 'exact' ]) ] |
|
101 | + #[ORM\JoinColumn(name: 'company_id', referencedColumnName: 'id') ] |
|
102 | + #[ORM\ManyToOne(targetEntity: People::class) ] |
|
103 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write' ] ]) ] |
|
104 | 104 | private $company; |
105 | 105 | |
106 | - #[ORM\JoinColumn(name: 'product_unity_id', referencedColumnName: 'id')] |
|
107 | - #[ORM\ManyToOne(targetEntity: ProductUnity::class)] |
|
108 | - #[ApiResource(normalizationContext: ['groups' => ['product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write']])] |
|
106 | + #[ORM\JoinColumn(name: 'product_unity_id', referencedColumnName: 'id') ] |
|
107 | + #[ORM\ManyToOne(targetEntity: ProductUnity::class) ] |
|
108 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write' ] ]) ] |
|
109 | 109 | private $productUnit; |
110 | 110 | |
111 | - #[ORM\JoinColumn(name: 'queue_id', referencedColumnName: 'id')] |
|
112 | - #[ORM\ManyToOne(targetEntity: Queue::class)] |
|
113 | - #[ApiResource(normalizationContext: ['groups' => ['product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write']])] |
|
111 | + #[ORM\JoinColumn(name: 'queue_id', referencedColumnName: 'id') ] |
|
112 | + #[ORM\ManyToOne(targetEntity: Queue::class) ] |
|
113 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_category:read', 'product:read', 'product_group_product:read', 'order_product:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'product:write' ] ]) ] |
|
114 | 114 | private $queue; |
115 | 115 | |
116 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['defaultOutInventory' => 'exact'])] |
|
117 | - #[ORM\JoinColumn(name: 'default_out_inventory_id', referencedColumnName: 'id', nullable: true)] |
|
118 | - #[ORM\ManyToOne(targetEntity: Inventory::class)] |
|
119 | - #[ApiResource(normalizationContext: ['groups' => ['product:read', 'product:write']])] |
|
116 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'defaultOutInventory' => 'exact' ]) ] |
|
117 | + #[ORM\JoinColumn(name: 'default_out_inventory_id', referencedColumnName: 'id', nullable: true) ] |
|
118 | + #[ORM\ManyToOne(targetEntity: Inventory::class) ] |
|
119 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product:read', 'product:write' ] ]) ] |
|
120 | 120 | private $defaultOutInventory; |
121 | 121 | |
122 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['defaultInInventory' => 'exact'])] |
|
123 | - #[ORM\JoinColumn(name: 'default_in_inventory_id', referencedColumnName: 'id', nullable: true)] |
|
124 | - #[ORM\ManyToOne(targetEntity: Inventory::class)] |
|
125 | - #[ApiResource(normalizationContext: ['groups' => ['product:read', 'product:write']])] |
|
122 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'defaultInInventory' => 'exact' ]) ] |
|
123 | + #[ORM\JoinColumn(name: 'default_in_inventory_id', referencedColumnName: 'id', nullable: true) ] |
|
124 | + #[ORM\ManyToOne(targetEntity: Inventory::class) ] |
|
125 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product:read', 'product:write' ] ]) ] |
|
126 | 126 | private $defaultInInventory; |
127 | 127 | |
128 | 128 | public function __construct() |
@@ -18,61 +18,61 @@ |
||
18 | 18 | #[ApiResource( |
19 | 19 | operations: [ |
20 | 20 | new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'), |
21 | - new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product_inventory:write']]), |
|
21 | + new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product_inventory:write' ] ]), |
|
22 | 22 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
23 | 23 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
24 | 24 | new GetCollection(security: 'is_granted(\'PUBLIC_ACCESS\')'), |
25 | 25 | ], |
26 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
27 | - normalizationContext: ['groups' => ['product_inventory:read']], |
|
28 | - denormalizationContext: ['groups' => ['product_inventory:write']] |
|
29 | -)] |
|
30 | -#[ApiFilter(OrderFilter::class, properties: ['id', 'available', 'sales', 'ordered', 'transit'])] |
|
31 | -#[ApiFilter(SearchFilter::class, properties: ['id' => 'exact', 'inventory' => 'exact', 'product' => 'exact'])] |
|
32 | -#[ORM\Table(name: 'product_inventory')] |
|
33 | -#[ORM\Index(name: 'inventory_id', columns: ['inventory_id'])] |
|
34 | -#[ORM\Index(name: 'product_id', columns: ['product_id'])] |
|
35 | -#[ORM\Entity(repositoryClass: ProductInventoryRepository::class)] |
|
26 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
27 | + normalizationContext: [ 'groups' => [ 'product_inventory:read' ] ], |
|
28 | + denormalizationContext: [ 'groups' => [ 'product_inventory:write' ] ] |
|
29 | +) ] |
|
30 | +#[ApiFilter(OrderFilter::class, properties: [ 'id', 'available', 'sales', 'ordered', 'transit' ]) ] |
|
31 | +#[ApiFilter(SearchFilter::class, properties: [ 'id' => 'exact', 'inventory' => 'exact', 'product' => 'exact' ]) ] |
|
32 | +#[ORM\Table(name: 'product_inventory') ] |
|
33 | +#[ORM\Index(name: 'inventory_id', columns: [ 'inventory_id' ]) ] |
|
34 | +#[ORM\Index(name: 'product_id', columns: [ 'product_id' ]) ] |
|
35 | +#[ORM\Entity(repositoryClass: ProductInventoryRepository::class) ] |
|
36 | 36 | class ProductInventory |
37 | 37 | { |
38 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
39 | - #[ORM\Id] |
|
40 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
41 | - #[ApiResource(normalizationContext: ['groups' => ['product_inventory:read', 'product_inventory:write']])] |
|
38 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
39 | + #[ORM\Id ] |
|
40 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
41 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_inventory:read', 'product_inventory:write' ] ]) ] |
|
42 | 42 | private $id; |
43 | 43 | |
44 | - #[ORM\JoinColumn(name: 'inventory_id', referencedColumnName: 'id', nullable: false)] |
|
45 | - #[ORM\ManyToOne(targetEntity: Inventory::class)] |
|
46 | - #[ApiResource(normalizationContext: ['groups' => ['product_inventory:read', 'product_inventory:write']])] |
|
44 | + #[ORM\JoinColumn(name: 'inventory_id', referencedColumnName: 'id', nullable: false) ] |
|
45 | + #[ORM\ManyToOne(targetEntity: Inventory::class) ] |
|
46 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_inventory:read', 'product_inventory:write' ] ]) ] |
|
47 | 47 | private $inventory; |
48 | 48 | |
49 | - #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id', nullable: false)] |
|
50 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
51 | - #[ApiResource(normalizationContext: ['groups' => ['product_inventory:read', 'product_inventory:write']])] |
|
49 | + #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id', nullable: false) ] |
|
50 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
51 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_inventory:read', 'product_inventory:write' ] ]) ] |
|
52 | 52 | private $product; |
53 | 53 | |
54 | - #[ORM\Column(name: 'available', type: 'integer', nullable: false, options: ['default' => 0])] |
|
55 | - #[ApiResource(normalizationContext: ['groups' => ['product_inventory:read', 'product_inventory:write']])] |
|
54 | + #[ORM\Column(name: 'available', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ] |
|
55 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_inventory:read', 'product_inventory:write' ] ]) ] |
|
56 | 56 | private $available = 0; |
57 | 57 | |
58 | - #[ORM\Column(name: 'sales', type: 'integer', nullable: false, options: ['default' => 0])] |
|
59 | - #[ApiResource(normalizationContext: ['groups' => ['product_inventory:read', 'product_inventory:write']])] |
|
58 | + #[ORM\Column(name: 'sales', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ] |
|
59 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_inventory:read', 'product_inventory:write' ] ]) ] |
|
60 | 60 | private $sales = 0; |
61 | 61 | |
62 | - #[ORM\Column(name: 'ordered', type: 'integer', nullable: false, options: ['default' => 0])] |
|
63 | - #[ApiResource(normalizationContext: ['groups' => ['product_inventory:read', 'product_inventory:write']])] |
|
62 | + #[ORM\Column(name: 'ordered', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ] |
|
63 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_inventory:read', 'product_inventory:write' ] ]) ] |
|
64 | 64 | private $ordered = 0; |
65 | 65 | |
66 | - #[ORM\Column(name: 'transit', type: 'integer', nullable: false, options: ['default' => 0])] |
|
67 | - #[ApiResource(normalizationContext: ['groups' => ['product_inventory:read', 'product_inventory:write']])] |
|
66 | + #[ORM\Column(name: 'transit', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ] |
|
67 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_inventory:read', 'product_inventory:write' ] ]) ] |
|
68 | 68 | private $transit = 0; |
69 | 69 | |
70 | - #[ORM\Column(name: 'minimum', type: 'integer', nullable: false, options: ['default' => 0])] |
|
71 | - #[ApiResource(normalizationContext: ['groups' => ['product_inventory:read', 'product_inventory:write']])] |
|
70 | + #[ORM\Column(name: 'minimum', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ] |
|
71 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_inventory:read', 'product_inventory:write' ] ]) ] |
|
72 | 72 | private $minimum = 0; |
73 | 73 | |
74 | - #[ORM\Column(name: 'maximum', type: 'integer', nullable: false, options: ['default' => 0])] |
|
75 | - #[ApiResource(normalizationContext: ['groups' => ['product_inventory:read', 'product_inventory:write']])] |
|
74 | + #[ORM\Column(name: 'maximum', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ] |
|
75 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_inventory:read', 'product_inventory:write' ] ]) ] |
|
76 | 76 | private $maximum = 0; |
77 | 77 | |
78 | 78 | public function getId(): ?int |