@@ -18,7 +18,7 @@ |
||
| 18 | 18 | RequestStack $requestStack |
| 19 | 19 | |
| 20 | 20 | ) { |
| 21 | - $this->request = $requestStack->getCurrentRequest(); |
|
| 21 | + $this->request = $requestStack->getCurrentRequest(); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
@@ -51,8 +51,9 @@ |
||
| 51 | 51 | $this->peopleService->getMyCompanies() |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | - if ($company) |
|
| 55 | - $qb->andWhere('pe = :company')->setParameter('company', $company); |
|
| 54 | + if ($company) { |
|
| 55 | + $qb->andWhere('pe = :company')->setParameter('company', $company); |
|
| 56 | + } |
|
| 56 | 57 | |
| 57 | 58 | return $qb->getQuery()->getResult(); |
| 58 | 59 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | class ProductRepository extends ServiceEntityRepository |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - private $inventory_exclude_types = ['custom', 'component', 'manufactured']; |
|
| 22 | + private $inventory_exclude_types = [ 'custom', 'component', 'manufactured' ]; |
|
| 23 | 23 | |
| 24 | 24 | public function __construct( |
| 25 | 25 | private PeopleService $peopleService, |
@@ -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 |
@@ -24,66 +24,66 @@ discard block |
||
| 24 | 24 | new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'), |
| 25 | 25 | new Put( |
| 26 | 26 | security: 'is_granted(\'ROLE_CLIENT\')', |
| 27 | - denormalizationContext: ['groups' => ['product_group:write']] |
|
| 27 | + denormalizationContext: [ 'groups' => [ 'product_group:write' ] ] |
|
| 28 | 28 | ), |
| 29 | 29 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
| 30 | 30 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
| 31 | 31 | new GetCollection(security: 'is_granted(\'PUBLIC_ACCESS\')') |
| 32 | 32 | ], |
| 33 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
| 34 | - normalizationContext: ['groups' => ['product_group:read']], |
|
| 35 | - denormalizationContext: ['groups' => ['product_group:write']] |
|
| 36 | -)] |
|
| 37 | -#[ApiFilter(OrderFilter::class, properties: ['productGroup'])] |
|
| 38 | -#[ORM\Table(name: 'product_group')] |
|
| 39 | -#[ORM\Entity(repositoryClass: ProductGroupRepository::class)] |
|
| 33 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
| 34 | + normalizationContext: [ 'groups' => [ 'product_group:read' ] ], |
|
| 35 | + denormalizationContext: [ 'groups' => [ 'product_group:write' ] ] |
|
| 36 | +) ] |
|
| 37 | +#[ApiFilter(OrderFilter::class, properties: [ 'productGroup' ]) ] |
|
| 38 | +#[ORM\Table(name: 'product_group') ] |
|
| 39 | +#[ORM\Entity(repositoryClass: ProductGroupRepository::class) ] |
|
| 40 | 40 | class ProductGroup |
| 41 | 41 | { |
| 42 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
|
| 43 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
| 44 | - #[ORM\Id] |
|
| 45 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
| 46 | - #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])] |
|
| 42 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'id' => 'exact' ]) ] |
|
| 43 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
| 44 | + #[ORM\Id ] |
|
| 45 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
| 46 | + #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ] |
|
| 47 | 47 | private $id; |
| 48 | 48 | |
| 49 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productGroup' => 'exact'])] |
|
| 50 | - #[ORM\Column(name: 'product_group', type: 'string', length: 255, nullable: false)] |
|
| 51 | - #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])] |
|
| 49 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productGroup' => 'exact' ]) ] |
|
| 50 | + #[ORM\Column(name: 'product_group', type: 'string', length: 255, nullable: false) ] |
|
| 51 | + #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ] |
|
| 52 | 52 | private $productGroup; |
| 53 | 53 | |
| 54 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['priceCalculation' => 'exact'])] |
|
| 55 | - #[ORM\Column(name: 'price_calculation', type: 'string', length: 0, nullable: false, options: ['default' => "'sum'"])] |
|
| 56 | - #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])] |
|
| 54 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'priceCalculation' => 'exact' ]) ] |
|
| 55 | + #[ORM\Column(name: 'price_calculation', type: 'string', length: 0, nullable: false, options: [ 'default' => "'sum'" ]) ] |
|
| 56 | + #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ] |
|
| 57 | 57 | private $priceCalculation = 'sum'; |
| 58 | 58 | |
| 59 | - #[ORM\Column(name: 'required', type: 'boolean', nullable: false)] |
|
| 60 | - #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])] |
|
| 59 | + #[ORM\Column(name: 'required', type: 'boolean', nullable: false) ] |
|
| 60 | + #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ] |
|
| 61 | 61 | private $required = false; |
| 62 | 62 | |
| 63 | - #[ORM\Column(name: 'minimum', type: 'integer', nullable: true, options: ['default' => 'NULL'])] |
|
| 64 | - #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])] |
|
| 63 | + #[ORM\Column(name: 'minimum', type: 'integer', nullable: true, options: [ 'default' => 'NULL' ]) ] |
|
| 64 | + #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ] |
|
| 65 | 65 | private $minimum = null; |
| 66 | 66 | |
| 67 | - #[ORM\Column(name: 'maximum', type: 'integer', nullable: true, options: ['default' => 'NULL'])] |
|
| 68 | - #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])] |
|
| 67 | + #[ORM\Column(name: 'maximum', type: 'integer', nullable: true, options: [ 'default' => 'NULL' ]) ] |
|
| 68 | + #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ] |
|
| 69 | 69 | private $maximum = null; |
| 70 | 70 | |
| 71 | - #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: ['default' => '1'])] |
|
| 72 | - #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])] |
|
| 71 | + #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: [ 'default' => '1' ]) ] |
|
| 72 | + #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ] |
|
| 73 | 73 | private $active = true; |
| 74 | 74 | |
| 75 | - #[ORM\Column(name: 'group_order', type: 'integer', nullable: false)] |
|
| 76 | - #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])] |
|
| 75 | + #[ORM\Column(name: 'group_order', type: 'integer', nullable: false) ] |
|
| 76 | + #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ] |
|
| 77 | 77 | private $groupOrder = 0; |
| 78 | 78 | |
| 79 | - #[ORM\OneToMany(targetEntity: ProductGroupProduct::class, mappedBy: 'productGroup', orphanRemoval: true)] |
|
| 80 | - #[Groups(['product_group:write'])] |
|
| 79 | + #[ORM\OneToMany(targetEntity: ProductGroupProduct::class, mappedBy: 'productGroup', orphanRemoval: true) ] |
|
| 80 | + #[Groups([ 'product_group:write' ]) ] |
|
| 81 | 81 | private $products; |
| 82 | 82 | |
| 83 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productParent' => 'exact'])] |
|
| 84 | - #[ORM\JoinColumn(nullable: false)] |
|
| 85 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
| 86 | - #[Groups(['product_group:read', 'product_group:write'])] |
|
| 83 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productParent' => 'exact' ]) ] |
|
| 84 | + #[ORM\JoinColumn(nullable: false) ] |
|
| 85 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
| 86 | + #[Groups([ 'product_group:read', 'product_group:write' ]) ] |
|
| 87 | 87 | private $productParent; |
| 88 | 88 | |
| 89 | 89 | public function __construct() |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | public function addProduct(ProductGroupProduct $product): self |
| 192 | 192 | { |
| 193 | 193 | if (!$this->products->contains($product)) { |
| 194 | - $this->products[] = $product; |
|
| 194 | + $this->products[ ] = $product; |
|
| 195 | 195 | $product->setProductGroup($this); |
| 196 | 196 | } |
| 197 | 197 | return $this; |
@@ -24,107 +24,107 @@ |
||
| 24 | 24 | #[ApiResource( |
| 25 | 25 | operations: [ |
| 26 | 26 | new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'), |
| 27 | - new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product:write']]), |
|
| 27 | + new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product:write' ] ]), |
|
| 28 | 28 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
| 29 | 29 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
| 30 | 30 | new GetCollection(security: 'is_granted(\'PUBLIC_ACCESS\')'), |
| 31 | 31 | ], |
| 32 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
| 33 | - normalizationContext: ['groups' => ['product:read']], |
|
| 34 | - denormalizationContext: ['groups' => ['product:write']] |
|
| 35 | -)] |
|
| 36 | -#[ApiFilter(OrderFilter::class, properties: ['product', 'price', 'description'])] |
|
| 37 | -#[ApiFilter(RandomOrderFilter::class)] |
|
| 38 | -#[ORM\Table(name: 'product')] |
|
| 39 | -#[ORM\Index(name: 'product_unity_id', columns: ['product_unity_id'])] |
|
| 40 | -#[ORM\Index(name: 'IDX_D34A04AD979B1AD6', columns: ['company_id'])] |
|
| 41 | -#[ORM\Index(name: 'default_out_inventory_id', columns: ['default_out_inventory_id'])] |
|
| 42 | -#[ORM\Index(name: 'default_in_inventory_id', columns: ['default_in_inventory_id'])] |
|
| 43 | -#[ORM\UniqueConstraint(name: 'company_id', columns: ['company_id', 'sku'])] |
|
| 44 | -#[ORM\Entity(repositoryClass: ProductRepository::class)] |
|
| 32 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
| 33 | + normalizationContext: [ 'groups' => [ 'product:read' ] ], |
|
| 34 | + denormalizationContext: [ 'groups' => [ 'product:write' ] ] |
|
| 35 | +) ] |
|
| 36 | +#[ApiFilter(OrderFilter::class, properties: [ 'product', 'price', 'description' ]) ] |
|
| 37 | +#[ApiFilter(RandomOrderFilter::class) ] |
|
| 38 | +#[ORM\Table(name: 'product') ] |
|
| 39 | +#[ORM\Index(name: 'product_unity_id', columns: [ 'product_unity_id' ]) ] |
|
| 40 | +#[ORM\Index(name: 'IDX_D34A04AD979B1AD6', columns: [ 'company_id' ]) ] |
|
| 41 | +#[ORM\Index(name: 'default_out_inventory_id', columns: [ 'default_out_inventory_id' ]) ] |
|
| 42 | +#[ORM\Index(name: 'default_in_inventory_id', columns: [ 'default_in_inventory_id' ]) ] |
|
| 43 | +#[ORM\UniqueConstraint(name: 'company_id', columns: [ 'company_id', 'sku' ]) ] |
|
| 44 | +#[ORM\Entity(repositoryClass: ProductRepository::class) ] |
|
| 45 | 45 | class Product |
| 46 | 46 | { |
| 47 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
|
| 48 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
| 49 | - #[ORM\Id] |
|
| 50 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
| 51 | - #[Groups(['product_category:read', 'product:read', 'order_product:read'])] |
|
| 47 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'id' => 'exact' ]) ] |
|
| 48 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
| 49 | + #[ORM\Id ] |
|
| 50 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
| 51 | + #[Groups([ 'product_category:read', 'product:read', 'order_product:read' ]) ] |
|
| 52 | 52 | private $id; |
| 53 | 53 | |
| 54 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['product' => 'partial'])] |
|
| 55 | - #[ORM\Column(name: 'product', type: 'string', length: 255, nullable: true)] |
|
| 56 | - #[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'])] |
|
| 54 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'product' => 'partial' ]) ] |
|
| 55 | + #[ORM\Column(name: 'product', type: 'string', length: 255, nullable: true) ] |
|
| 56 | + #[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' ]) ] |
|
| 57 | 57 | private $product; |
| 58 | 58 | |
| 59 | - #[ApiFilter(filterClass: ExistsFilter::class, properties: ['productFiles'])] |
|
| 60 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productFiles.file.fileType' => 'exact'])] |
|
| 61 | - #[ORM\OneToMany(targetEntity: ProductFile::class, mappedBy: 'product')] |
|
| 62 | - #[Groups(['product:read', 'product_category:read', 'order_product:read'])] |
|
| 59 | + #[ApiFilter(filterClass: ExistsFilter::class, properties: [ 'productFiles' ]) ] |
|
| 60 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productFiles.file.fileType' => 'exact' ]) ] |
|
| 61 | + #[ORM\OneToMany(targetEntity: ProductFile::class, mappedBy: 'product') ] |
|
| 62 | + #[Groups([ 'product:read', 'product_category:read', 'order_product:read' ]) ] |
|
| 63 | 63 | private $productFiles; |
| 64 | 64 | |
| 65 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productCategory.category' => 'exact'])] |
|
| 66 | - #[ORM\OneToMany(targetEntity: ProductCategory::class, mappedBy: 'product')] |
|
| 65 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productCategory.category' => 'exact' ]) ] |
|
| 66 | + #[ORM\OneToMany(targetEntity: ProductCategory::class, mappedBy: 'product') ] |
|
| 67 | 67 | private $productCategory; |
| 68 | 68 | |
| 69 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['sku' => 'partial'])] |
|
| 70 | - #[ORM\Column(name: 'sku', type: 'string', length: 32, nullable: true, options: ['default' => 'NULL'])] |
|
| 71 | - #[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'])] |
|
| 69 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'sku' => 'partial' ]) ] |
|
| 70 | + #[ORM\Column(name: 'sku', type: 'string', length: 32, nullable: true, options: [ 'default' => 'NULL' ]) ] |
|
| 71 | + #[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 | 72 | private $sku = null; |
| 73 | 73 | |
| 74 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['type' => 'exact'])] |
|
| 75 | - #[ORM\Column(name: 'type', type: 'string', length: 0, nullable: false, options: ['default' => "'product'"])] |
|
| 76 | - #[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'])] |
|
| 74 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'type' => 'exact' ]) ] |
|
| 75 | + #[ORM\Column(name: 'type', type: 'string', length: 0, nullable: false, options: [ 'default' => "'product'" ]) ] |
|
| 76 | + #[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 | 77 | private $type = 'product'; |
| 78 | 78 | |
| 79 | - #[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 0, nullable: false)] |
|
| 80 | - #[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 | + #[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 0, nullable: false) ] |
|
| 80 | + #[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 | 81 | private $price = 0; |
| 82 | 82 | |
| 83 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productCondition' => 'exact'])] |
|
| 84 | - #[ORM\Column(name: 'product_condition', type: 'string', length: 0, nullable: false, options: ['default' => "'new'"])] |
|
| 85 | - #[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'])] |
|
| 83 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productCondition' => 'exact' ]) ] |
|
| 84 | + #[ORM\Column(name: 'product_condition', type: 'string', length: 0, nullable: false, options: [ 'default' => "'new'" ]) ] |
|
| 85 | + #[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 | 86 | private $productCondition = 'new'; |
| 87 | 87 | |
| 88 | - #[ORM\Column(name: 'description', type: 'string', length: 0, nullable: false)] |
|
| 89 | - #[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 | + #[ORM\Column(name: 'description', type: 'string', length: 0, nullable: false) ] |
|
| 89 | + #[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 | 90 | private $description = ''; |
| 91 | 91 | |
| 92 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['featured' => 'exact'])] |
|
| 93 | - #[ORM\Column(name: 'featured', type: 'boolean', nullable: false, options: ['default' => '0'])] |
|
| 94 | - #[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'])] |
|
| 92 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'featured' => 'exact' ]) ] |
|
| 93 | + #[ORM\Column(name: 'featured', type: 'boolean', nullable: false, options: [ 'default' => '0' ]) ] |
|
| 94 | + #[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 | 95 | private $featured = false; |
| 96 | 96 | |
| 97 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['active' => 'exact'])] |
|
| 98 | - #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: ['default' => '1'])] |
|
| 99 | - #[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'])] |
|
| 97 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'active' => 'exact' ]) ] |
|
| 98 | + #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: [ 'default' => '1' ]) ] |
|
| 99 | + #[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 | 100 | private $active = true; |
| 101 | 101 | |
| 102 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['company' => 'exact'])] |
|
| 103 | - #[ORM\JoinColumn(name: 'company_id', referencedColumnName: 'id')] |
|
| 104 | - #[ORM\ManyToOne(targetEntity: People::class)] |
|
| 105 | - #[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'])] |
|
| 102 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'company' => 'exact' ]) ] |
|
| 103 | + #[ORM\JoinColumn(name: 'company_id', referencedColumnName: 'id') ] |
|
| 104 | + #[ORM\ManyToOne(targetEntity: People::class) ] |
|
| 105 | + #[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 | 106 | private $company; |
| 107 | 107 | |
| 108 | - #[ORM\JoinColumn(name: 'product_unity_id', referencedColumnName: 'id')] |
|
| 109 | - #[ORM\ManyToOne(targetEntity: ProductUnity::class)] |
|
| 110 | - #[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'])] |
|
| 108 | + #[ORM\JoinColumn(name: 'product_unity_id', referencedColumnName: 'id') ] |
|
| 109 | + #[ORM\ManyToOne(targetEntity: ProductUnity::class) ] |
|
| 110 | + #[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 | 111 | private $productUnit; |
| 112 | 112 | |
| 113 | - #[ORM\JoinColumn(name: 'queue_id', referencedColumnName: 'id')] |
|
| 114 | - #[ORM\ManyToOne(targetEntity: Queue::class)] |
|
| 115 | - #[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'])] |
|
| 113 | + #[ORM\JoinColumn(name: 'queue_id', referencedColumnName: 'id') ] |
|
| 114 | + #[ORM\ManyToOne(targetEntity: Queue::class) ] |
|
| 115 | + #[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' ]) ] |
|
| 116 | 116 | private $queue; |
| 117 | 117 | |
| 118 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['defaultOutInventory' => 'exact'])] |
|
| 119 | - #[ORM\JoinColumn(name: 'default_out_inventory_id', referencedColumnName: 'id', nullable: true)] |
|
| 120 | - #[ORM\ManyToOne(targetEntity: Inventory::class)] |
|
| 121 | - #[Groups(['product:read', 'product:write'])] |
|
| 118 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'defaultOutInventory' => 'exact' ]) ] |
|
| 119 | + #[ORM\JoinColumn(name: 'default_out_inventory_id', referencedColumnName: 'id', nullable: true) ] |
|
| 120 | + #[ORM\ManyToOne(targetEntity: Inventory::class) ] |
|
| 121 | + #[Groups([ 'product:read', 'product:write' ]) ] |
|
| 122 | 122 | private $defaultOutInventory; |
| 123 | 123 | |
| 124 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['defaultInInventory' => 'exact'])] |
|
| 125 | - #[ORM\JoinColumn(name: 'default_in_inventory_id', referencedColumnName: 'id', nullable: true)] |
|
| 126 | - #[ORM\ManyToOne(targetEntity: Inventory::class)] |
|
| 127 | - #[Groups(['product:read', 'product:write'])] |
|
| 124 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'defaultInInventory' => 'exact' ]) ] |
|
| 125 | + #[ORM\JoinColumn(name: 'default_in_inventory_id', referencedColumnName: 'id', nullable: true) ] |
|
| 126 | + #[ORM\ManyToOne(targetEntity: Inventory::class) ] |
|
| 127 | + #[Groups([ 'product:read', 'product:write' ]) ] |
|
| 128 | 128 | private $defaultInInventory; |
| 129 | 129 | |
| 130 | 130 | public function __construct() |
@@ -17,31 +17,31 @@ |
||
| 17 | 17 | #[ApiResource( |
| 18 | 18 | operations: [ |
| 19 | 19 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
| 20 | - new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product_unity_edit']]), |
|
| 20 | + new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product_unity_edit' ] ]), |
|
| 21 | 21 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
| 22 | 22 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
| 23 | 23 | new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
| 24 | 24 | ], |
| 25 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
| 26 | - normalizationContext: ['groups' => ['product_unity:read']], |
|
| 27 | - denormalizationContext: ['groups' => ['product_unity:write']] |
|
| 28 | -)] |
|
| 29 | -#[ORM\Table(name: 'product_unity')] |
|
| 30 | -#[ORM\Entity(repositoryClass: ProductUnityRepository::class)] |
|
| 25 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
| 26 | + normalizationContext: [ 'groups' => [ 'product_unity:read' ] ], |
|
| 27 | + denormalizationContext: [ 'groups' => [ 'product_unity:write' ] ] |
|
| 28 | +) ] |
|
| 29 | +#[ORM\Table(name: 'product_unity') ] |
|
| 30 | +#[ORM\Entity(repositoryClass: ProductUnityRepository::class) ] |
|
| 31 | 31 | class ProductUnity |
| 32 | 32 | { |
| 33 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
| 34 | - #[ORM\Id] |
|
| 35 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
| 36 | - #[Groups(['product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read'])] |
|
| 33 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
| 34 | + #[ORM\Id ] |
|
| 35 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
| 36 | + #[Groups([ 'product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read' ]) ] |
|
| 37 | 37 | private $id; |
| 38 | 38 | |
| 39 | - #[ORM\Column(name: 'product_unit', type: 'string', length: 3, nullable: false)] |
|
| 40 | - #[Groups(['product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read'])] |
|
| 39 | + #[ORM\Column(name: 'product_unit', type: 'string', length: 3, nullable: false) ] |
|
| 40 | + #[Groups([ 'product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read' ]) ] |
|
| 41 | 41 | private $productUnit; |
| 42 | 42 | |
| 43 | - #[ORM\Column(name: 'unit_type', type: 'string', length: 0, nullable: false, options: ['default' => "'I'", 'comment' => 'Integer, Fractioned'])] |
|
| 44 | - #[Groups(['product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read'])] |
|
| 43 | + #[ORM\Column(name: 'unit_type', type: 'string', length: 0, nullable: false, options: [ 'default' => "'I'", 'comment' => 'Integer, Fractioned' ]) ] |
|
| 44 | + #[Groups([ 'product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read' ]) ] |
|
| 45 | 45 | private $unitType = 'I'; |
| 46 | 46 | |
| 47 | 47 | public function getId() |
@@ -20,61 +20,61 @@ |
||
| 20 | 20 | #[ApiResource( |
| 21 | 21 | operations: [ |
| 22 | 22 | new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'), |
| 23 | - new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product_inventory:write']]), |
|
| 23 | + new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product_inventory:write' ] ]), |
|
| 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(\'PUBLIC_ACCESS\')'), |
| 27 | 27 | ], |
| 28 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
| 29 | - normalizationContext: ['groups' => ['product_inventory:read']], |
|
| 30 | - denormalizationContext: ['groups' => ['product_inventory:write']] |
|
| 31 | -)] |
|
| 32 | -#[ApiFilter(OrderFilter::class, properties: ['id', 'available', 'sales', 'ordered', 'transit'])] |
|
| 33 | -#[ApiFilter(SearchFilter::class, properties: ['id' => 'exact', 'inventory' => 'exact', 'product' => 'exact'])] |
|
| 34 | -#[ORM\Table(name: 'product_inventory')] |
|
| 35 | -#[ORM\Index(name: 'inventory_id', columns: ['inventory_id'])] |
|
| 36 | -#[ORM\Index(name: 'product_id', columns: ['product_id'])] |
|
| 37 | -#[ORM\Entity(repositoryClass: ProductInventoryRepository::class)] |
|
| 28 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
| 29 | + normalizationContext: [ 'groups' => [ 'product_inventory:read' ] ], |
|
| 30 | + denormalizationContext: [ 'groups' => [ 'product_inventory:write' ] ] |
|
| 31 | +) ] |
|
| 32 | +#[ApiFilter(OrderFilter::class, properties: [ 'id', 'available', 'sales', 'ordered', 'transit' ]) ] |
|
| 33 | +#[ApiFilter(SearchFilter::class, properties: [ 'id' => 'exact', 'inventory' => 'exact', 'product' => 'exact' ]) ] |
|
| 34 | +#[ORM\Table(name: 'product_inventory') ] |
|
| 35 | +#[ORM\Index(name: 'inventory_id', columns: [ 'inventory_id' ]) ] |
|
| 36 | +#[ORM\Index(name: 'product_id', columns: [ 'product_id' ]) ] |
|
| 37 | +#[ORM\Entity(repositoryClass: ProductInventoryRepository::class) ] |
|
| 38 | 38 | class ProductInventory |
| 39 | 39 | { |
| 40 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
| 41 | - #[ORM\Id] |
|
| 42 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
| 43 | - #[Groups(['product_inventory:read', 'product_inventory:write'])] |
|
| 40 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
| 41 | + #[ORM\Id ] |
|
| 42 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
| 43 | + #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ] |
|
| 44 | 44 | private $id; |
| 45 | 45 | |
| 46 | - #[ORM\JoinColumn(name: 'inventory_id', referencedColumnName: 'id', nullable: false)] |
|
| 47 | - #[ORM\ManyToOne(targetEntity: Inventory::class)] |
|
| 48 | - #[Groups(['product_inventory:read', 'product_inventory:write'])] |
|
| 46 | + #[ORM\JoinColumn(name: 'inventory_id', referencedColumnName: 'id', nullable: false) ] |
|
| 47 | + #[ORM\ManyToOne(targetEntity: Inventory::class) ] |
|
| 48 | + #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ] |
|
| 49 | 49 | private $inventory; |
| 50 | 50 | |
| 51 | - #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id', nullable: false)] |
|
| 52 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
| 53 | - #[Groups(['product_inventory:read', 'product_inventory:write'])] |
|
| 51 | + #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id', nullable: false) ] |
|
| 52 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
| 53 | + #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ] |
|
| 54 | 54 | private $product; |
| 55 | 55 | |
| 56 | - #[ORM\Column(name: 'available', type: 'integer', nullable: false, options: ['default' => 0])] |
|
| 57 | - #[Groups(['product_inventory:read', 'product_inventory:write'])] |
|
| 56 | + #[ORM\Column(name: 'available', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ] |
|
| 57 | + #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ] |
|
| 58 | 58 | private $available = 0; |
| 59 | 59 | |
| 60 | - #[ORM\Column(name: 'sales', type: 'integer', nullable: false, options: ['default' => 0])] |
|
| 61 | - #[Groups(['product_inventory:read', 'product_inventory:write'])] |
|
| 60 | + #[ORM\Column(name: 'sales', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ] |
|
| 61 | + #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ] |
|
| 62 | 62 | private $sales = 0; |
| 63 | 63 | |
| 64 | - #[ORM\Column(name: 'ordered', type: 'integer', nullable: false, options: ['default' => 0])] |
|
| 65 | - #[Groups(['product_inventory:read', 'product_inventory:write'])] |
|
| 64 | + #[ORM\Column(name: 'ordered', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ] |
|
| 65 | + #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ] |
|
| 66 | 66 | private $ordered = 0; |
| 67 | 67 | |
| 68 | - #[ORM\Column(name: 'transit', type: 'integer', nullable: false, options: ['default' => 0])] |
|
| 69 | - #[Groups(['product_inventory:read', 'product_inventory:write'])] |
|
| 68 | + #[ORM\Column(name: 'transit', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ] |
|
| 69 | + #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ] |
|
| 70 | 70 | private $transit = 0; |
| 71 | 71 | |
| 72 | - #[ORM\Column(name: 'minimum', type: 'integer', nullable: false, options: ['default' => 0])] |
|
| 73 | - #[Groups(['product_inventory:read', 'product_inventory:write'])] |
|
| 72 | + #[ORM\Column(name: 'minimum', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ] |
|
| 73 | + #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ] |
|
| 74 | 74 | private $minimum = 0; |
| 75 | 75 | |
| 76 | - #[ORM\Column(name: 'maximum', type: 'integer', nullable: false, options: ['default' => 0])] |
|
| 77 | - #[Groups(['product_inventory:read', 'product_inventory:write'])] |
|
| 76 | + #[ORM\Column(name: 'maximum', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ] |
|
| 77 | + #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ] |
|
| 78 | 78 | private $maximum = 0; |
| 79 | 79 | |
| 80 | 80 | public function getId(): ?int |
@@ -34,31 +34,31 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $products = $this->getProductsInventory($provider); |
| 36 | 36 | |
| 37 | - $groupedByInventory = []; |
|
| 37 | + $groupedByInventory = [ ]; |
|
| 38 | 38 | foreach ($products as $product) { |
| 39 | - $inventoryName = $product['inventory_name']; |
|
| 40 | - if (!isset($groupedByInventory[$inventoryName])) { |
|
| 41 | - $groupedByInventory[$inventoryName] = []; |
|
| 39 | + $inventoryName = $product[ 'inventory_name' ]; |
|
| 40 | + if (!isset($groupedByInventory[ $inventoryName ])) { |
|
| 41 | + $groupedByInventory[ $inventoryName ] = [ ]; |
|
| 42 | 42 | } |
| 43 | - $groupedByInventory[$inventoryName][] = $product; |
|
| 43 | + $groupedByInventory[ $inventoryName ][ ] = $product; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | foreach ($groupedByInventory as $inventoryName => $items) { |
| 47 | - $companyName = $items[0]['company_name']; |
|
| 47 | + $companyName = $items[ 0 ][ 'company_name' ]; |
|
| 48 | 48 | $this->printService->addLine("", "", "-"); |
| 49 | 49 | $this->printService->addLine($companyName, "", " "); |
| 50 | - $this->printService->addLine("INVENTARIO: " . $inventoryName, "", " "); |
|
| 50 | + $this->printService->addLine("INVENTARIO: ".$inventoryName, "", " "); |
|
| 51 | 51 | $this->printService->addLine("", "", "-"); |
| 52 | 52 | $this->printService->addLine("Produto", "Disponivel", " "); |
| 53 | 53 | $this->printService->addLine("", "", "-"); |
| 54 | 54 | |
| 55 | 55 | foreach ($items as $item) { |
| 56 | - $productName = substr($item['product_name'], 0, 20); |
|
| 57 | - if (!empty($item['description'])) { |
|
| 58 | - $productName .= " " . substr($item['description'], 0, 10); |
|
| 56 | + $productName = substr($item[ 'product_name' ], 0, 20); |
|
| 57 | + if (!empty($item[ 'description' ])) { |
|
| 58 | + $productName .= " ".substr($item[ 'description' ], 0, 10); |
|
| 59 | 59 | } |
| 60 | - $productName .= " (" . $item['productUnit'] . ")"; |
|
| 61 | - $available = str_pad($item['available'], 4, " ", STR_PAD_LEFT); |
|
| 60 | + $productName .= " (".$item[ 'productUnit' ].")"; |
|
| 61 | + $available = str_pad($item[ 'available' ], 4, " ", STR_PAD_LEFT); |
|
| 62 | 62 | $this->printService->addLine($productName, $available, " "); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -77,13 +77,13 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | $products = $this->getPurchasingSuggestion($provider); |
| 79 | 79 | |
| 80 | - $groupedByCompany = []; |
|
| 80 | + $groupedByCompany = [ ]; |
|
| 81 | 81 | foreach ($products as $product) { |
| 82 | - $companyName = $product['company_name']; |
|
| 83 | - if (!isset($groupedByCompany[$companyName])) { |
|
| 84 | - $groupedByCompany[$companyName] = []; |
|
| 82 | + $companyName = $product[ 'company_name' ]; |
|
| 83 | + if (!isset($groupedByCompany[ $companyName ])) { |
|
| 84 | + $groupedByCompany[ $companyName ] = [ ]; |
|
| 85 | 85 | } |
| 86 | - $groupedByCompany[$companyName][] = $product; |
|
| 86 | + $groupedByCompany[ $companyName ][ ] = $product; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $this->printService->addLine("", "", "-"); |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | $this->printService->addLine("", "", "-"); |
| 98 | 98 | |
| 99 | 99 | foreach ($items as $item) { |
| 100 | - $productName = substr($item['product_name'], 0, 20); |
|
| 101 | - if (!empty($item['description'])) { |
|
| 102 | - $productName .= " " . substr($item['description'], 0, 10); |
|
| 100 | + $productName = substr($item[ 'product_name' ], 0, 20); |
|
| 101 | + if (!empty($item[ 'description' ])) { |
|
| 102 | + $productName .= " ".substr($item[ 'description' ], 0, 10); |
|
| 103 | 103 | } |
| 104 | - if (!empty($item['unity'])) { |
|
| 105 | - $productName .= " (" . $item['unity'] . ")"; |
|
| 104 | + if (!empty($item[ 'unity' ])) { |
|
| 105 | + $productName .= " (".$item[ 'unity' ].")"; |
|
| 106 | 106 | } |
| 107 | - $needed = str_pad($item['needed'], 4, " ", STR_PAD_LEFT); |
|
| 107 | + $needed = str_pad($item[ 'needed' ], 4, " ", STR_PAD_LEFT); |
|
| 108 | 108 | $this->printService->addLine($productName, $needed, " "); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -20,38 +20,38 @@ |
||
| 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_file:write']] |
|
| 23 | + denormalizationContext: [ 'groups' => [ 'product_file: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_file:read']], |
|
| 31 | - denormalizationContext: ['groups' => ['product_file:write']] |
|
| 32 | -)] |
|
| 33 | -#[ApiFilter(filterClass: SearchFilter::class, properties: ['file' => 'exact', 'file.fileType' => 'exact', 'product' => 'exact'])] |
|
| 34 | -#[ORM\Table(name: 'product_file')] |
|
| 35 | -#[ORM\Index(name: 'file_id', columns: ['file_id'])] |
|
| 36 | -#[ORM\Index(name: 'IDX_CDFC73564584665B', columns: ['product_id'])] |
|
| 37 | -#[ORM\UniqueConstraint(name: 'product_id', columns: ['product_id', 'file_id'])] |
|
| 38 | -#[ORM\Entity(repositoryClass: ProductFileRepository::class)] |
|
| 29 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
| 30 | + normalizationContext: [ 'groups' => [ 'product_file:read' ] ], |
|
| 31 | + denormalizationContext: [ 'groups' => [ 'product_file:write' ] ] |
|
| 32 | +) ] |
|
| 33 | +#[ApiFilter(filterClass: SearchFilter::class, properties: [ 'file' => 'exact', 'file.fileType' => 'exact', 'product' => 'exact' ]) ] |
|
| 34 | +#[ORM\Table(name: 'product_file') ] |
|
| 35 | +#[ORM\Index(name: 'file_id', columns: [ 'file_id' ]) ] |
|
| 36 | +#[ORM\Index(name: 'IDX_CDFC73564584665B', columns: [ 'product_id' ]) ] |
|
| 37 | +#[ORM\UniqueConstraint(name: 'product_id', columns: [ 'product_id', 'file_id' ]) ] |
|
| 38 | +#[ORM\Entity(repositoryClass: ProductFileRepository::class) ] |
|
| 39 | 39 | class ProductFile |
| 40 | 40 | { |
| 41 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
| 42 | - #[ORM\Id] |
|
| 43 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
| 44 | - #[Groups(['product:read', 'order_product:read', 'product_file:read', 'product_category:read'])] |
|
| 41 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
| 42 | + #[ORM\Id ] |
|
| 43 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
| 44 | + #[Groups([ 'product:read', 'order_product:read', 'product_file:read', 'product_category:read' ]) ] |
|
| 45 | 45 | private int $id = 0; |
| 46 | 46 | |
| 47 | - #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id')] |
|
| 48 | - #[ORM\ManyToOne(targetEntity: File::class)] |
|
| 49 | - #[Groups(['product:read', 'order_product:read', 'product_file:read', 'product_file:write', 'product_category:read'])] |
|
| 47 | + #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id') ] |
|
| 48 | + #[ORM\ManyToOne(targetEntity: File::class) ] |
|
| 49 | + #[Groups([ 'product:read', 'order_product:read', 'product_file:read', 'product_file:write', 'product_category:read' ]) ] |
|
| 50 | 50 | private File $file; |
| 51 | 51 | |
| 52 | - #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id')] |
|
| 53 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
| 54 | - #[Groups(['product_file:read', 'product_file:write'])] |
|
| 52 | + #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id') ] |
|
| 53 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
| 54 | + #[Groups([ 'product_file:read', 'product_file:write' ]) ] |
|
| 55 | 55 | private Product $product; |
| 56 | 56 | |
| 57 | 57 | public function getId(): int |