diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index afa2e6a..d350ddf 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,21 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -14,6 +28,11 @@
$PROJECT_DIR$/composer.json
+
+
+
+
+
@@ -220,15 +239,17 @@
"RunOnceActivity.git.unshallow": "true",
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
"com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1": "true",
+ "database.data.extractors.current.export.id": "Comma-separated (CSV)_id",
+ "database.data.extractors.current.id": "Comma-separated (CSV)_id",
"git-widget-placeholder": "feat/271-expedition-etape-1",
"junie.onboarding.icon.badge.shown": "true",
- "last_opened_file_path": "/home/sroy/Documents/test/Ferme",
+ "last_opened_file_path": "//wsl.localhost/Ubuntu-24.04/home/matte/Ferme/frontend/services",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
- "settings.editor.selected.configurable": "configurable.group.appearance",
+ "settings.editor.selected.configurable": "preferences.keymap",
"to.speed.mode.migration.done": "true",
"ts.external.directory.path": "/opt/phpstorm/plugins/javascript-plugin/jsLanguageServicesImpl/external",
"vue.rearranger.settings.migration": "true"
@@ -246,6 +267,13 @@
}
}]]>
+
+
+
+
+
+
+
@@ -257,7 +285,6 @@
-
@@ -288,15 +315,10 @@
-
-
-
-
- 1768237763998
-
-
-
- 1768237763998
+
+
+
+
@@ -682,7 +704,15 @@
1770136359244
-
+
+
+ 1770136475283
+
+
+
+ 1770136475283
+
+
@@ -759,8 +789,27 @@
+
+
+
+
+ file://$PROJECT_DIR$/frontend/stores/reception.ts
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/makefile b/makefile
index 0856c61..8065f4b 100644
--- a/makefile
+++ b/makefile
@@ -79,7 +79,7 @@ migration-migrate:
$(SYMFONY_CONSOLE) --no-interaction doctrine:migrations:migrate --allow-no-migration
fixtures:
- $(SYMFONY_CONSOLE) doctrine:fixtures:load
+ $(SYMFONY_CONSOLE) --no-interaction doctrine:fixtures:load
# Attention, supprime votre bdd local
db-reset:
diff --git a/migrations/Version20260203152543.php b/migrations/Version20260203152543.php
deleted file mode 100644
index ac37491..0000000
--- a/migrations/Version20260203152543.php
+++ /dev/null
@@ -1,64 +0,0 @@
-addSql('CREATE TABLE bovin_shipment (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, nb_bovin_send INT NOT NULL, shipment_id INT DEFAULT NULL, bovine_type_id INT DEFAULT NULL, PRIMARY KEY (id))');
- $this->addSql('CREATE INDEX IDX_7049F4507BE036FC ON bovin_shipment (shipment_id)');
- $this->addSql('CREATE INDEX IDX_7049F4507899F32E ON bovin_shipment (bovine_type_id)');
- $this->addSql('CREATE TABLE bovine_type_shipment (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, type_label VARCHAR(255) NOT NULL, type_code VARCHAR(255) NOT NULL, PRIMARY KEY (id))');
- $this->addSql('CREATE TABLE customer (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, customer_label VARCHAR(255) NOT NULL, customer_code VARCHAR(255) NOT NULL, id_adress_id INT DEFAULT NULL, PRIMARY KEY (id))');
- $this->addSql('CREATE INDEX IDX_81398E094B3458B ON customer (id_adress_id)');
- $this->addSql('CREATE TABLE shipment (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, date_receipt TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, is_waiting BOOLEAN NOT NULL, licence_plate VARCHAR(255) NOT NULL, test VARCHAR(255) NOT NULL, id_carrier_id INT DEFAULT NULL, id_carrier_1_id INT DEFAULT NULL, id_truck_id INT DEFAULT NULL, licence_plate_1_id INT DEFAULT NULL, id_vehicle_id INT DEFAULT NULL, id_customer_id INT DEFAULT NULL, PRIMARY KEY (id))');
- $this->addSql('CREATE INDEX IDX_2CB20DC84554740 ON shipment (id_carrier_id)');
- $this->addSql('CREATE INDEX IDX_2CB20DC817F550F ON shipment (id_carrier_1_id)');
- $this->addSql('CREATE INDEX IDX_2CB20DC964E905B ON shipment (id_truck_id)');
- $this->addSql('CREATE INDEX IDX_2CB20DC3B17D73A ON shipment (licence_plate_1_id)');
- $this->addSql('CREATE INDEX IDX_2CB20DCF1D99706 ON shipment (id_vehicle_id)');
- $this->addSql('CREATE INDEX IDX_2CB20DC8B870E04 ON shipment (id_customer_id)');
- $this->addSql('ALTER TABLE bovin_shipment ADD CONSTRAINT FK_7049F4507BE036FC FOREIGN KEY (shipment_id) REFERENCES shipment (id)');
- $this->addSql('ALTER TABLE bovin_shipment ADD CONSTRAINT FK_7049F4507899F32E FOREIGN KEY (bovine_type_id) REFERENCES bovine_type_shipment (id)');
- $this->addSql('ALTER TABLE customer ADD CONSTRAINT FK_81398E094B3458B FOREIGN KEY (id_adress_id) REFERENCES address (id)');
- $this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DC84554740 FOREIGN KEY (id_carrier_id) REFERENCES carrier (id)');
- $this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DC817F550F FOREIGN KEY (id_carrier_1_id) REFERENCES vehicle (id)');
- $this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DC964E905B FOREIGN KEY (id_truck_id) REFERENCES vehicle (id)');
- $this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DC3B17D73A FOREIGN KEY (licence_plate_1_id) REFERENCES carrier (id)');
- $this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DCF1D99706 FOREIGN KEY (id_vehicle_id) REFERENCES vehicle (id)');
- $this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DC8B870E04 FOREIGN KEY (id_customer_id) REFERENCES customer (id)');
- }
-
- public function down(Schema $schema): void
- {
- // this down() migration is auto-generated, please modify it to your needs
- $this->addSql('ALTER TABLE bovin_shipment DROP CONSTRAINT FK_7049F4507BE036FC');
- $this->addSql('ALTER TABLE bovin_shipment DROP CONSTRAINT FK_7049F4507899F32E');
- $this->addSql('ALTER TABLE customer DROP CONSTRAINT FK_81398E094B3458B');
- $this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DC84554740');
- $this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DC817F550F');
- $this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DC964E905B');
- $this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DC3B17D73A');
- $this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DCF1D99706');
- $this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DC8B870E04');
- $this->addSql('DROP TABLE bovin_shipment');
- $this->addSql('DROP TABLE bovine_type_shipment');
- $this->addSql('DROP TABLE customer');
- $this->addSql('DROP TABLE shipment');
- }
-}
diff --git a/migrations/Version20260204101625.php b/migrations/Version20260204101625.php
new file mode 100644
index 0000000..9dd7038
--- /dev/null
+++ b/migrations/Version20260204101625.php
@@ -0,0 +1,64 @@
+addSql('CREATE TABLE bovin_shipment (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, nb_bovin_send INT NOT NULL, shipment_id INT DEFAULT NULL, shipment_type_id INT DEFAULT NULL, PRIMARY KEY (id))');
+ $this->addSql('CREATE INDEX IDX_7049F4507BE036FC ON bovin_shipment (shipment_id)');
+ $this->addSql('CREATE INDEX IDX_7049F4502EE48A36 ON bovin_shipment (shipment_type_id)');
+ $this->addSql('CREATE TABLE customer (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, label VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, PRIMARY KEY (id))');
+ $this->addSql('CREATE TABLE customer_address (customer_id INT NOT NULL, address_id INT NOT NULL, PRIMARY KEY (customer_id, address_id))');
+ $this->addSql('CREATE INDEX IDX_1193CB3F9395C3F3 ON customer_address (customer_id)');
+ $this->addSql('CREATE INDEX IDX_1193CB3FF5B7AF75 ON customer_address (address_id)');
+ $this->addSql('CREATE TABLE shipment (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, licence_plate VARCHAR(255) NOT NULL, identification_number VARCHAR(20) DEFAULT NULL, current_step INT DEFAULT 0 NOT NULL, is_valid BOOLEAN NOT NULL, shipment_date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, carrier_id INT DEFAULT NULL, vehicle_id INT DEFAULT NULL, truck_id INT DEFAULT NULL, customer_id INT DEFAULT NULL, PRIMARY KEY (id))');
+ $this->addSql('CREATE UNIQUE INDEX UNIQ_2CB20DC347639A5 ON shipment (identification_number)');
+ $this->addSql('CREATE INDEX IDX_2CB20DC21DFC797 ON shipment (carrier_id)');
+ $this->addSql('CREATE INDEX IDX_2CB20DC545317D1 ON shipment (vehicle_id)');
+ $this->addSql('CREATE INDEX IDX_2CB20DCC6957CCE ON shipment (truck_id)');
+ $this->addSql('CREATE INDEX IDX_2CB20DC9395C3F3 ON shipment (customer_id)');
+ $this->addSql('CREATE TABLE shipment_type (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, label VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, PRIMARY KEY (id))');
+ $this->addSql('ALTER TABLE bovin_shipment ADD CONSTRAINT FK_7049F4507BE036FC FOREIGN KEY (shipment_id) REFERENCES shipment (id)');
+ $this->addSql('ALTER TABLE bovin_shipment ADD CONSTRAINT FK_7049F4502EE48A36 FOREIGN KEY (shipment_type_id) REFERENCES shipment_type (id)');
+ $this->addSql('ALTER TABLE customer_address ADD CONSTRAINT FK_1193CB3F9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id) ON DELETE CASCADE');
+ $this->addSql('ALTER TABLE customer_address ADD CONSTRAINT FK_1193CB3FF5B7AF75 FOREIGN KEY (address_id) REFERENCES address (id) ON DELETE CASCADE');
+ $this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DC21DFC797 FOREIGN KEY (carrier_id) REFERENCES carrier (id) NOT DEFERRABLE');
+ $this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DC545317D1 FOREIGN KEY (vehicle_id) REFERENCES vehicle (id)');
+ $this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DCC6957CCE FOREIGN KEY (truck_id) REFERENCES truck (id) NOT DEFERRABLE');
+ $this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DC9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
+ }
+
+ public function down(Schema $schema): void
+ {
+ // this down() migration is auto-generated, please modify it to your needs
+ $this->addSql('ALTER TABLE bovin_shipment DROP CONSTRAINT FK_7049F4507BE036FC');
+ $this->addSql('ALTER TABLE bovin_shipment DROP CONSTRAINT FK_7049F4502EE48A36');
+ $this->addSql('ALTER TABLE customer_address DROP CONSTRAINT FK_1193CB3F9395C3F3');
+ $this->addSql('ALTER TABLE customer_address DROP CONSTRAINT FK_1193CB3FF5B7AF75');
+ $this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DC21DFC797');
+ $this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DC545317D1');
+ $this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DCC6957CCE');
+ $this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DC9395C3F3');
+ $this->addSql('DROP TABLE bovin_shipment');
+ $this->addSql('DROP TABLE customer');
+ $this->addSql('DROP TABLE customer_address');
+ $this->addSql('DROP TABLE shipment');
+ $this->addSql('DROP TABLE shipment_type');
+ }
+}
diff --git a/migrations/Version20260204102423.php b/migrations/Version20260204102423.php
new file mode 100644
index 0000000..7db4507
--- /dev/null
+++ b/migrations/Version20260204102423.php
@@ -0,0 +1,35 @@
+addSql('ALTER TABLE shipment DROP CONSTRAINT fk_2cb20dc545317d1');
+ $this->addSql('DROP INDEX idx_2cb20dc545317d1');
+ $this->addSql('ALTER TABLE shipment DROP vehicle_id');
+ }
+
+ public function down(Schema $schema): void
+ {
+ // this down() migration is auto-generated, please modify it to your needs
+ $this->addSql('ALTER TABLE shipment ADD vehicle_id INT DEFAULT NULL');
+ $this->addSql('ALTER TABLE shipment ADD CONSTRAINT fk_2cb20dc545317d1 FOREIGN KEY (vehicle_id) REFERENCES vehicle (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
+ $this->addSql('CREATE INDEX idx_2cb20dc545317d1 ON shipment (vehicle_id)');
+ }
+}
diff --git a/src/Entity/Address.php b/src/Entity/Address.php
index c06a159..e51450c 100644
--- a/src/Entity/Address.php
+++ b/src/Entity/Address.php
@@ -35,27 +35,27 @@ class Address
private ?int $id = null;
#[ORM\Column(length: 120)]
- #[Groups(['address:read', 'supplier:read', 'reception:read'])]
+ #[Groups(['address:read', 'supplier:read', 'reception:read', 'customer:read', 'shipment:read'])]
private string $label = '';
#[ORM\Column(length: 180)]
- #[Groups(['address:read', 'supplier:read', 'reception:read'])]
+ #[Groups(['address:read', 'supplier:read', 'reception:read', 'customer:read', 'shipment:read'])]
private string $street = '';
#[ORM\Column(name: 'street2', length: 180, nullable: true)]
- #[Groups(['address:read', 'supplier:read', 'reception:read'])]
+ #[Groups(['address:read', 'supplier:read', 'reception:read', 'customer:read', 'shipment:read'])]
private ?string $street2 = null;
#[ORM\Column(name: 'postal_code', length: 20)]
- #[Groups(['address:read', 'supplier:read', 'reception:read'])]
+ #[Groups(['address:read', 'supplier:read', 'reception:read', 'customer:read', 'shipment:read'])]
private string $postalCode = '';
#[ORM\Column(length: 120)]
- #[Groups(['address:read', 'supplier:read', 'reception:read'])]
+ #[Groups(['address:read', 'supplier:read', 'reception:read', 'customer:read', 'shipment:read'])]
private string $city = '';
#[ORM\Column(name: 'country_code', length: 2)]
- #[Groups(['address:read', 'supplier:read'])]
+ #[Groups(['address:read', 'supplier:read', 'customer:read'])]
private string $countryCode = '';
/**
@@ -64,16 +64,9 @@ class Address
#[ORM\ManyToMany(targetEntity: Supplier::class, mappedBy: 'addresses')]
private Collection $suppliers;
- /**
- * @var Collection
- */
- #[ORM\OneToMany(targetEntity: Customer::class, mappedBy: 'id_adress')]
- private Collection $customers;
-
public function __construct()
{
$this->suppliers = new ArrayCollection();
- $this->customers = new ArrayCollection();
}
public function getId(): ?int
@@ -172,34 +165,4 @@ class Address
{
return $this->suppliers;
}
-
- /**
- * @return Collection
- */
- public function getCustomers(): Collection
- {
- return $this->customers;
- }
-
- public function addCustomer(Customer $customer): static
- {
- if (!$this->customers->contains($customer)) {
- $this->customers->add($customer);
- $customer->setIdAdress($this);
- }
-
- return $this;
- }
-
- public function removeCustomer(Customer $customer): static
- {
- if ($this->customers->removeElement($customer)) {
- // set the owning side to null (unless already changed)
- if ($customer->getIdAdress() === $this) {
- $customer->setIdAdress(null);
- }
- }
-
- return $this;
- }
}
diff --git a/src/Entity/BovinShipment.php b/src/Entity/BovinShipment.php
index bf4b7c4..e538215 100644
--- a/src/Entity/BovinShipment.php
+++ b/src/Entity/BovinShipment.php
@@ -7,8 +7,6 @@ namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
-use ApiPlatform\Metadata\Patch;
-use ApiPlatform\Metadata\Post;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Attribute\Groups;
@@ -23,15 +21,7 @@ use Symfony\Component\Serializer\Attribute\Groups;
new GetCollection(
normalizationContext: ['groups' => ['bovin-shipment:read']],
),
- new Post(
- normalizationContext: ['groups' => ['bovin-shipment:read']],
- denormalizationContext: ['groups' => ['bovin-shipment:write']],
- ),
- new Patch(
- requirements: ['id' => '\d+'],
- normalizationContext: ['groups' => ['bovin-shipment:read']],
- denormalizationContext: ['groups' => ['bovin-shipment:write']],
- ),
+
// new Get(
// uriTemplate: '/receptions/weigh',
// openapi: new OpenApiOperation(
@@ -62,16 +52,16 @@ class BovinShipment
#[Groups(['shipment:read', 'bovine-shipment:read'])]
private ?int $id = null;
- #[ORM\ManyToOne(inversedBy: 'shipment')]
- #[Groups(['shipment:read', 'shipment:write', 'bovine-shipment:read', 'bovine-shipment:write'])]
- private ?Shipment $Shipment = null;
+ #[ORM\ManyToOne(inversedBy: 'shipment_types')]
+ #[Groups(['bovine-shipment:read'])]
+ private ?Shipment $shipment = null;
- #[ORM\ManyToOne(inversedBy: 'bovinShipments')]
- #[Groups(['shipment:read', 'shipment:write', 'bovine-shipment:read', 'bovine-shipment:write'])]
- private ?BovineTypeShipment $BovineType = null;
+ #[ORM\ManyToOne]
+ #[Groups(['shipment:read', 'bovine-shipment:read'])]
+ private ?ShipmentType $shipmentType = null;
#[ORM\Column]
- #[Groups(['shipment:read', 'shipment:write', 'bovine-shipment:read', 'bovine-shipment:write'])]
+ #[Groups(['shipment:read', 'bovine-shipment:read'])]
private ?int $nbBovinSend = null;
public function getId(): ?int
@@ -79,28 +69,24 @@ class BovinShipment
return $this->id;
}
- public function getIdShipment(): ?Shipment
+ public function getShipment(): ?Shipment
{
- return $this->Shipment;
+ return $this->shipment;
}
- public function setIdShipment(?Shipment $Shipment): static
+ public function setShipment(?Shipment $shipment): void
{
- $this->Shipment = $Shipment;
-
- return $this;
+ $this->shipment = $shipment;
}
- public function getIdType(): ?BovineTypeShipment
+ public function getShipmentType(): ?ShipmentType
{
- return $this->BovineType;
+ return $this->shipmentType;
}
- public function setIdType(?BovineTypeShipment $BovineType): static
+ public function setShipmentType(?ShipmentType $shipmentType): void
{
- $this->BovineType = $BovineType;
-
- return $this;
+ $this->shipmentType = $shipmentType;
}
public function getNbBovinSend(): ?int
@@ -108,10 +94,8 @@ class BovinShipment
return $this->nbBovinSend;
}
- public function setNbBovinSend(int $nbBovinSend): static
+ public function setNbBovinSend(?int $nbBovinSend): void
{
$this->nbBovinSend = $nbBovinSend;
-
- return $this;
}
}
diff --git a/src/Entity/BovineTypeShipment.php b/src/Entity/BovineTypeShipment.php
deleted file mode 100644
index f333fdc..0000000
--- a/src/Entity/BovineTypeShipment.php
+++ /dev/null
@@ -1,110 +0,0 @@
-
- */
- #[ORM\OneToMany(targetEntity: BovinShipment::class, mappedBy: 'id_type')]
- #[Groups(['shipment:read', 'shipment:write', 'bovine-type:read', 'bovine-type:write'])]
- private Collection $bovinShipments;
-
- public function __construct()
- {
- $this->bovinShipments = new ArrayCollection();
- }
-
- public function getId(): ?int
- {
- return $this->id;
- }
-
- public function getTypeLabel(): ?string
- {
- return $this->type_label;
- }
-
- public function setTypeLabel(string $type_label): static
- {
- $this->type_label = $type_label;
-
- return $this;
- }
-
- public function getTypeCode(): ?string
- {
- return $this->type_code;
- }
-
- public function setTypeCode(string $type_code): static
- {
- $this->type_code = $type_code;
-
- return $this;
- }
-
- public function getBovineShipment(): ?BovineShipment
- {
- return $this->bovineShipment;
- }
-
- public function setBovineShipment(?BovineShipment $bovineShipment): static
- {
- $this->bovineShipment = $bovineShipment;
-
- return $this;
- }
-
- /**
- * @return Collection
- */
- public function getBovinShipments(): Collection
- {
- return $this->bovinShipments;
- }
-
- public function addBovinShipment(BovinShipment $bovinShipment): static
- {
- if (!$this->bovinShipments->contains($bovinShipment)) {
- $this->bovinShipments->add($bovinShipment);
- $bovinShipment->setIdType($this);
- }
-
- return $this;
- }
-
- public function removeBovinShipment(BovinShipment $bovinShipment): static
- {
- if ($this->bovinShipments->removeElement($bovinShipment)) {
- // set the owning side to null (unless already changed)
- if ($bovinShipment->getIdType() === $this) {
- $bovinShipment->setIdType(null);
- }
- }
-
- return $this;
- }
-}
diff --git a/src/Entity/Carrier.php b/src/Entity/Carrier.php
index 5f9ace4..a520eda 100644
--- a/src/Entity/Carrier.php
+++ b/src/Entity/Carrier.php
@@ -7,8 +7,6 @@ namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
-use Doctrine\Common\Collections\ArrayCollection;
-use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Attribute\Groups;
@@ -31,35 +29,17 @@ class Carrier
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
- #[Groups(['carrier:read', 'driver:read', 'vehicle:read', 'reception:read'])]
+ #[Groups(['carrier:read', 'driver:read', 'vehicle:read', 'reception:read', 'shipment:read'])]
private ?int $id = null;
#[ORM\Column(length: 180)]
- #[Groups(['carrier:read', 'driver:read', 'vehicle:read', 'reception:read'])]
+ #[Groups(['carrier:read', 'driver:read', 'vehicle:read', 'reception:read', 'shipment:read'])]
private string $name = '';
#[ORM\Column(length: 30, nullable: true)]
- #[Groups(['carrier:read', 'driver:read', 'vehicle:read', 'reception:read'])]
+ #[Groups(['carrier:read', 'driver:read', 'vehicle:read', 'reception:read', 'shipment:read'])]
private ?string $code = null;
- /**
- * @var Collection
- */
- #[ORM\OneToMany(targetEntity: Shipment::class, mappedBy: 'id_carrier')]
- private Collection $id_carrier_1;
-
- /**
- * @var Collection
- */
- #[ORM\OneToMany(targetEntity: Shipment::class, mappedBy: 'licence_plate_1')]
- private Collection $shipments;
-
- public function __construct()
- {
- $this->id_carrier_1 = new ArrayCollection();
- $this->shipments = new ArrayCollection();
- }
-
public function getId(): ?int
{
return $this->id;
@@ -88,64 +68,4 @@ class Carrier
return $this;
}
-
- /**
- * @return Collection
- */
- public function getIdCarrier1(): Collection
- {
- return $this->id_carrier_1;
- }
-
- public function addIdCarrier1(Shipment $idCarrier1): static
- {
- if (!$this->id_carrier_1->contains($idCarrier1)) {
- $this->id_carrier_1->add($idCarrier1);
- $idCarrier1->setIdCarrier($this);
- }
-
- return $this;
- }
-
- public function removeIdCarrier1(Shipment $idCarrier1): static
- {
- if ($this->id_carrier_1->removeElement($idCarrier1)) {
- // set the owning side to null (unless already changed)
- if ($idCarrier1->getIdCarrier() === $this) {
- $idCarrier1->setIdCarrier(null);
- }
- }
-
- return $this;
- }
-
- /**
- * @return Collection
- */
- public function getShipments(): Collection
- {
- return $this->shipments;
- }
-
- public function addShipment(Shipment $shipment): static
- {
- if (!$this->shipments->contains($shipment)) {
- $this->shipments->add($shipment);
- $shipment->setLicencePlate1($this);
- }
-
- return $this;
- }
-
- public function removeShipment(Shipment $shipment): static
- {
- if ($this->shipments->removeElement($shipment)) {
- // set the owning side to null (unless already changed)
- if ($shipment->getLicencePlate1() === $this) {
- $shipment->setLicencePlate1(null);
- }
- }
-
- return $this;
- }
}
diff --git a/src/Entity/Customer.php b/src/Entity/Customer.php
index 03bcbcd..ad6e09c 100644
--- a/src/Entity/Customer.php
+++ b/src/Entity/Customer.php
@@ -4,11 +4,29 @@ declare(strict_types=1);
namespace App\Entity;
+use ApiPlatform\Metadata\ApiProperty;
+use ApiPlatform\Metadata\ApiResource;
+use ApiPlatform\Metadata\Get;
+use ApiPlatform\Metadata\GetCollection;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
+use Symfony\Component\Serializer\Attribute\Groups;
#[ORM\Entity]
+#[ORM\Table(name: 'customer')]
+#[ApiResource(
+ operations: [
+ new Get(
+ requirements: ['id' => '\d+'],
+ normalizationContext: ['groups' => ['customer:read']],
+ ),
+ new GetCollection(
+ normalizationContext: ['groups' => ['customer:read']],
+ ),
+ ],
+ security: "is_granted('ROLE_USER')",
+)]
class Customer
{
#[ORM\Id]
@@ -18,26 +36,25 @@ class Customer
private ?int $id = null;
#[ORM\Column(length: 255)]
- #[Groups(['shipment:read', 'shipment:write', 'customer:read', 'customer:write'])]
- private ?string $customer_label = null;
+ #[Groups(['customer:read', 'shipment:read'])]
+ private ?string $label = null;
#[ORM\Column(length: 255)]
- #[Groups(['shipment:read', 'shipment:write', 'customer:read', 'customer:write'])]
- private ?string $customer_code = null;
-
- #[ORM\ManyToOne(inversedBy: 'customers')]
- #[Groups(['shipment:read', 'shipment:write', 'customer:read', 'customer:write'])]
- private ?Address $id_adress = null;
+ #[Groups(['customer:read', 'shipment:read'])]
+ private ?string $code = null;
/**
- * @var Collection
+ * @var Collection
*/
- #[ORM\OneToMany(targetEntity: Shipment::class, mappedBy: 'id_customer')]
- private Collection $shipments;
+ #[ORM\ManyToMany(targetEntity: Address::class, inversedBy: 'customers')]
+ #[ORM\JoinTable(name: 'customer_address')]
+ #[Groups(['customer:read'])]
+ #[ApiProperty(readableLink: true)]
+ private Collection $addresses;
public function __construct()
{
- $this->shipments = new ArrayCollection();
+ $this->addresses = new ArrayCollection();
}
public function getId(): ?int
@@ -45,69 +62,33 @@ class Customer
return $this->id;
}
- public function getCustomerLabel(): ?string
+ public function getLabel(): ?string
{
- return $this->customer_label;
+ return $this->label;
}
- public function setCustomerLabel(string $customer_label): static
+ public function setLabel(?string $label): void
{
- $this->customer_label = $customer_label;
-
- return $this;
+ $this->label = $label;
}
- public function getCustomerCode(): ?string
+ public function getCode(): ?string
{
- return $this->customer_code;
+ return $this->code;
}
- public function setCustomerCode(string $customer_code): static
+ public function setCode(?string $code): void
{
- $this->customer_code = $customer_code;
-
- return $this;
+ $this->code = $code;
}
- public function getIdAdress(): ?Address
+ public function getAddresses(): Collection
{
- return $this->id_adress;
+ return $this->addresses;
}
- public function setIdAdress(?Address $id_adress): static
+ public function setAddresses(Collection $addresses): void
{
- $this->id_adress = $id_adress;
-
- return $this;
- }
-
- /**
- * @return Collection
- */
- public function getShipments(): Collection
- {
- return $this->shipments;
- }
-
- public function addShipment(Shipment $shipment): static
- {
- if (!$this->shipments->contains($shipment)) {
- $this->shipments->add($shipment);
- $shipment->setIdCustomer($this);
- }
-
- return $this;
- }
-
- public function removeShipment(Shipment $shipment): static
- {
- if ($this->shipments->removeElement($shipment)) {
- // set the owning side to null (unless already changed)
- if ($shipment->getIdCustomer() === $this) {
- $shipment->setIdCustomer(null);
- }
- }
-
- return $this;
+ $this->addresses = $addresses;
}
}
diff --git a/src/Entity/Shipment.php b/src/Entity/Shipment.php
index 74a5299..24f41a5 100644
--- a/src/Entity/Shipment.php
+++ b/src/Entity/Shipment.php
@@ -4,16 +4,18 @@ declare(strict_types=1);
namespace App\Entity;
+use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
-use DateTime;
-use Doctrine\Common\Collections\ArrayCollection;
+use DateTimeImmutable;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
+use Symfony\Component\Serializer\Attribute\Context;
use Symfony\Component\Serializer\Attribute\Groups;
+use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
#[ORM\Entity]
#[ORM\Table(name: 'shipment')]
@@ -36,24 +38,24 @@ use Symfony\Component\Serializer\Attribute\Groups;
denormalizationContext: ['groups' => ['shipment:write']],
),
// new Get(
- // uriTemplate: '/receptions/weigh',
+ // uriTemplate: '/shipments/weigh',
// openapi: new OpenApiOperation(
// summary: 'Fetch the current weight reading',
// description: 'Queries the pont-bascule and returns the weight data.',
// ),
- // normalizationContext: ['groups' => ['reception:weigh:read']],
+ // normalizationContext: ['groups' => ['shipment:weigh:read']],
// output: PontBasculeReading::class,
- // provider: ReceptionWeighingProvider::class,
+ // provider: shipmentWeighingProvider::class,
// ),
// new Get(
- // uriTemplate: '/receptions/{id}/receipt',
+ // uriTemplate: '/shipments/{id}/receipt',
// requirements: ['id' => '\d+'],
// openapi: new OpenApiOperation(
- // summary: 'Render a reception receipt',
- // description: 'Returns a PDF receipt for the reception.',
+ // summary: 'Render a shipment receipt',
+ // description: 'Returns a PDF receipt for the shipment.',
// ),
// output: false,
- // provider: ReceptionReceiptProvider::class,
+ // provider: shipmentReceiptProvider::class,
// ),
],
)]
@@ -65,54 +67,53 @@ class Shipment
#[Groups(['shipment:read'])]
private ?int $id = null;
- #[ORM\Column]
- #[Groups(['shipment:read', 'shipment:write'])]
- private ?DateTime $date_receipt = null;
-
- #[ORM\Column]
- #[Groups(['shipment:read', 'shipment:write'])]
- private ?bool $is_waiting = null;
-
#[ORM\Column(length: 255)]
#[Groups(['shipment:read', 'shipment:write'])]
- private ?string $licence_plate = null;
+ private ?string $licencePlate = null;
- #[ORM\ManyToOne(inversedBy: 'id_carrier_1')]
- #[Groups(['shipment:read', 'shipment:write'])]
- private ?carrier $id_carrier = null;
+ #[ORM\Column(length: 20, unique: true, nullable: true)]
+ #[Groups(['shipment:read'])]
+ private ?string $identificationNumber = null;
- #[ORM\ManyToOne(inversedBy: 'shipments')]
+ #[ORM\Column(options: ['default' => 0])]
#[Groups(['shipment:read', 'shipment:write'])]
- private ?vehicle $id_carrier_1 = null;
+ private int $currentStep = 0;
- #[ORM\ManyToOne(inversedBy: 'shipments')]
+ #[ORM\Column]
#[Groups(['shipment:read', 'shipment:write'])]
- private ?Vehicle $id_truck = null;
+ private ?bool $isValid = null;
- #[ORM\ManyToOne(inversedBy: 'shipments')]
+ #[ORM\Column(name: 'shipment_date', type: 'datetime_immutable')]
#[Groups(['shipment:read', 'shipment:write'])]
- private ?carrier $licence_plate_1 = null;
+ #[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
+ private ?DateTimeImmutable $shipmentDate = null;
- #[ORM\ManyToOne(inversedBy: 'shipments')]
+ #[ORM\ManyToOne]
+ #[ORM\JoinColumn(nullable: true)]
#[Groups(['shipment:read', 'shipment:write'])]
- private ?Vehicle $id_vehicle = null;
+ #[ApiProperty(readableLink: true)]
+ private ?Carrier $carrier = null;
- #[ORM\ManyToOne(inversedBy: 'shipments')]
+ #[ORM\ManyToOne]
+ #[ORM\JoinColumn(nullable: true)]
#[Groups(['shipment:read', 'shipment:write'])]
- private ?Customer $id_customer = null;
+ #[ApiProperty(readableLink: true)]
+ private ?Truck $truck = null;
+
+ #[ORM\ManyToOne]
+ #[Groups(['shipment:read', 'shipment:write'])]
+ private ?Customer $customer = null;
/**
* @var Collection
*/
- #[ORM\OneToMany(targetEntity: BovinShipment::class, mappedBy: 'id_shipment')]
- private Collection $id_type;
+ #[ORM\OneToMany(targetEntity: BovinShipment::class, mappedBy: 'shipment')]
+ #[Groups(['shipment:read', 'shipment:write'])]
+ private Collection $bovinShipments;
- #[ORM\Column(length: 255)]
- private ?string $test = null;
-
- public function __construct()
+ public function __construct(Collection $bovinShipments)
{
- $this->id_type = new ArrayCollection();
+ $this->bovinShipments = $bovinShipments;
}
public function getId(): ?int
@@ -120,165 +121,124 @@ class Shipment
return $this->id;
}
- public function getDateReceipt(): ?DateTime
- {
- return $this->date_receipt;
- }
-
- public function setDateReceipt(DateTime $date_receipt): static
- {
- $this->date_receipt = $date_receipt;
-
- return $this;
- }
-
- public function isWaiting(): ?bool
- {
- return $this->is_waiting;
- }
-
- public function setIsWaiting(bool $is_waiting): static
- {
- $this->is_waiting = $is_waiting;
-
- return $this;
- }
-
public function getLicencePlate(): ?string
{
- return $this->licence_plate;
+ return $this->licencePlate;
}
- public function setLicencePlate(string $licence_plate): static
+ public function setLicencePlate(?string $licencePlate): void
{
- $this->licence_plate = $licence_plate;
-
- return $this;
+ $this->licencePlate = $licencePlate;
}
- public function getIdCarrier(): ?carrier
+ public function getIdentificationNumber(): ?string
{
- return $this->id_carrier;
+ return $this->identificationNumber;
}
- public function setIdCarrier(?carrier $id_carrier): static
+ public function setIdentificationNumber(?string $identificationNumber): void
{
- $this->id_carrier = $id_carrier;
-
- return $this;
+ $this->identificationNumber = $identificationNumber;
}
- public function getIdCarrier1(): ?vehicle
+ public function getCurrentStep(): int
{
- return $this->id_carrier_1;
+ return $this->currentStep;
}
- public function setIdCarrier1(?vehicle $id_carrier_1): static
+ public function setCurrentStep(int $currentStep): void
{
- $this->id_carrier_1 = $id_carrier_1;
-
- return $this;
+ $this->currentStep = $currentStep;
}
- public function getIdTruck(): ?Vehicle
+ public function getIsValid(): ?bool
{
- return $this->id_truck;
+ return $this->isValid;
}
- public function setIdTruck(?Vehicle $id_truck): static
+ public function setIsValid(?bool $isValid): void
{
- $this->id_truck = $id_truck;
-
- return $this;
+ $this->isValid = $isValid;
}
- public function getLicencePlate1(): ?carrier
+ public function getShipmentDate(): ?DateTimeImmutable
{
- return $this->licence_plate_1;
+ return $this->shipmentDate;
}
- public function setLicencePlate1(?carrier $licence_plate_1): static
+ public function setShipmentDate(?DateTimeImmutable $shipmentDate): void
{
- $this->licence_plate_1 = $licence_plate_1;
-
- return $this;
+ $this->shipmentDate = $shipmentDate;
}
- public function getIdVehicle(): ?Vehicle
+ public function getCarrier(): ?Carrier
{
- return $this->id_vehicle;
+ return $this->carrier;
}
- public function setIdVehicle(?Vehicle $id_vehicle): static
+ public function setCarrier(?Carrier $carrier): void
{
- $this->id_vehicle = $id_vehicle;
-
- return $this;
+ $this->carrier = $carrier;
}
- public function getIdCustomer(): ?Customer
+ public function getVehicle(): ?Vehicle
{
- return $this->id_customer;
+ return $this->vehicle;
}
- public function setIdCustomer(?Customer $id_customer): static
+ public function setVehicle(?Vehicle $vehicle): void
{
- $this->id_customer = $id_customer;
-
- return $this;
+ $this->vehicle = $vehicle;
}
- public function getBovineShipment(): ?BovineShipment
+ public function getTruck(): ?Truck
{
- return $this->bovineShipment;
+ return $this->truck;
}
- public function setBovineShipment(?BovineShipment $bovineShipment): static
+ public function setTruck(?Truck $truck): void
{
- $this->bovineShipment = $bovineShipment;
-
- return $this;
+ $this->truck = $truck;
}
- /**
- * @return Collection
- */
- public function getIdType(): Collection
+ public function getCustomer(): ?Customer
{
- return $this->id_type;
+ return $this->customer;
}
- public function addIdType(BovinShipment $idType): static
+ public function setCustomer(?Customer $customer): void
{
- if (!$this->id_type->contains($idType)) {
- $this->id_type->add($idType);
- $idType->setIdShipment($this);
+ $this->customer = $customer;
+ }
+
+ public function getBovinShipments(): Collection
+ {
+ return $this->bovinShipments;
+ }
+
+ public function setBovinShipments(Collection $bovinShipments): void
+ {
+ $this->bovinShipments = $bovinShipments;
+ }
+
+ public function addPelletBuilding(BovinShipment $bovinShipments): self
+ {
+ if (!$this->bovinShipments->contains($bovinShipments)) {
+ $this->bovinShipments->add($bovinShipments);
+ $bovinShipments->setReception($this);
}
return $this;
}
- public function removeIdType(BovinShipment $idType): static
+ public function removePelletBuilding(BovinShipment $bovinShipments): self
{
- if ($this->id_type->removeElement($idType)) {
- // set the owning side to null (unless already changed)
- if ($idType->getIdShipment() === $this) {
- $idType->setIdShipment(null);
+ if ($this->bovinShipments->removeElement($bovinShipments)) {
+ if ($bovinShipments->getReception() === $this) {
+ $bovinShipments->setReception(null);
}
}
return $this;
}
-
- public function getTest(): ?string
- {
- return $this->test;
- }
-
- public function setTest(string $test): static
- {
- $this->test = $test;
-
- return $this;
- }
}
diff --git a/src/Entity/ShipmentType.php b/src/Entity/ShipmentType.php
new file mode 100644
index 0000000..0be6bc8
--- /dev/null
+++ b/src/Entity/ShipmentType.php
@@ -0,0 +1,71 @@
+ '\d+'],
+ normalizationContext: ['groups' => ['shipment-type:read']],
+ ),
+ new GetCollection(
+ normalizationContext: ['groups' => ['shipment-type:read']],
+ ),
+ ],
+ security: "is_granted('ROLE_USER')",
+)]
+class ShipmentType
+{
+ #[ORM\Id]
+ #[ORM\GeneratedValue]
+ #[ORM\Column]
+ #[Groups(['shipment-type:read', 'shipment:read'])]
+ private ?int $id = null;
+
+ #[ORM\Column(length: 255)]
+ #[Groups(['shipment-type:read', 'shipment:read'])]
+ private ?string $label = null;
+
+ #[ORM\Column(length: 255)]
+ #[Groups(['shipment-type:read', 'shipment:read'])]
+ private ?string $code = null;
+
+ public function getId(): ?int
+ {
+ return $this->id;
+ }
+
+ public function getLabel(): ?string
+ {
+ return $this->label;
+ }
+
+ public function setLabel(string $label): static
+ {
+ $this->label = $label;
+
+ return $this;
+ }
+
+ public function getCode(): ?string
+ {
+ return $this->code;
+ }
+
+ public function setCode(string $code): self
+ {
+ $this->code = $code;
+
+ return $this;
+ }
+}
diff --git a/src/Entity/Vehicle.php b/src/Entity/Vehicle.php
index ea6ec10..6a849ed 100644
--- a/src/Entity/Vehicle.php
+++ b/src/Entity/Vehicle.php
@@ -8,8 +8,6 @@ use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
-use Doctrine\Common\Collections\ArrayCollection;
-use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Attribute\Groups;
@@ -51,17 +49,6 @@ class Vehicle
#[ApiProperty(readableLink: true)]
private ?Truck $truck = null;
- /**
- * @var Collection
- */
- #[ORM\OneToMany(targetEntity: Shipment::class, mappedBy: 'id_carrier_1')]
- private Collection $shipments;
-
- public function __construct()
- {
- $this->shipments = new ArrayCollection();
- }
-
public function getId(): ?int
{
return $this->id;
@@ -102,34 +89,4 @@ class Vehicle
return $this;
}
-
- /**
- * @return Collection
- */
- public function getShipments(): Collection
- {
- return $this->shipments;
- }
-
- public function addShipment(Shipment $shipment): static
- {
- if (!$this->shipments->contains($shipment)) {
- $this->shipments->add($shipment);
- $shipment->setIdCarrier1($this);
- }
-
- return $this;
- }
-
- public function removeShipment(Shipment $shipment): static
- {
- if ($this->shipments->removeElement($shipment)) {
- // set the owning side to null (unless already changed)
- if ($shipment->getIdCarrier1() === $this) {
- $shipment->setIdCarrier1(null);
- }
- }
-
- return $this;
- }
}