ソースを参照

Merge branch 'feature/V8-7105-analyse---possibilit-doptimisati' into develop

Olivier Massot 7 ヶ月 前
コミット
0af3e7051a

+ 1 - 1
src/Entity/Access/Access.php

@@ -101,7 +101,7 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
     #[Groups(['private'])]
     private bool $superAdminAccess = false;
 
-    #[ORM\Column(nullable: true)]
+    #[ORM\Column(type: "smallint", nullable: true)]
     #[Groups(['my_access:input'])]
     private ?int $activityYear = null;
 

+ 7 - 1
src/Entity/Awin/Product.php

@@ -9,7 +9,13 @@ use Doctrine\ORM\Mapping as ORM;
 
 #[ApiResource(operations: [])]
 #[ORM\Entity]
-#[ORM\Table(name: 'AwinProduct')]
+#[ORM\Table(
+    name: 'AwinProduct',
+    indexes: [
+        new ORM\Index(columns: ["name"], name: "name_idx"),
+        new ORM\Index(columns: ["slug"], name: "slug_idx"),
+    ]
+)]
 class Product
 {
     #[ORM\Id]

+ 1 - 1
src/Entity/Core/AddressPostal.php

@@ -48,7 +48,7 @@ class AddressPostal
     #[Groups('address')]
     private ?string $addressOwner = null;
 
-    #[ORM\Column(length: 20, nullable: true)]
+    #[ORM\Column(length: 10, nullable: true)]
     #[Groups('address')]
     private ?string $postalCode = null;
 

+ 1 - 1
src/Entity/Core/BankAccount.php

@@ -54,7 +54,7 @@ class BankAccount
     /**
      * 0 => jamais facturé, 1 => facturé 1 fois, 2 => facturé plusieurs fois.
      */
-    #[ORM\Column(options: ['default' => 0])]
+    #[ORM\Column(columnDefinition: "TINYINT DEFAULT 0 NOT NULL")]
     private ?int $countInvoiced = 0;
 
     #[ORM\Column(length: 255, nullable: true)]

+ 1 - 1
src/Entity/Core/Categories.php

@@ -15,7 +15,7 @@ use Doctrine\ORM\Mapping as ORM;
 class Categories
 {
     #[ORM\Id]
-    #[ORM\Column]
+    #[ORM\Column(type: "mediumint", options: ["unsigned" => true])]
     #[ORM\GeneratedValue]
     private ?int $id = null;
 

+ 1 - 1
src/Entity/Core/City.php

@@ -15,7 +15,7 @@ use Doctrine\ORM\Mapping as ORM;
 class City
 {
     #[ORM\Id]
-    #[ORM\Column]
+    #[ORM\Column(type: "mediumint", options: ["unsigned" => true])]
     #[ORM\GeneratedValue]
     private ?int $id = null;
 

+ 3 - 3
src/Entity/Core/ContactPoint.php

@@ -53,19 +53,19 @@ class ContactPoint
     #[ORM\Column(type: 'phone_number', nullable: true)]
     private ?PhoneNumber $faxNumber = null;
 
-    #[ORM\Column(length: 255, nullable: true)]
+    #[ORM\Column(length: 30, nullable: true)]
     private ?string $faxNumberInvalid = null;
 
     #[ORM\Column(type: 'phone_number', nullable: true)]
     private ?PhoneNumber $telphone = null;
 
-    #[ORM\Column(length: 255, nullable: true)]
+    #[ORM\Column(length: 30, nullable: true)]
     private ?string $telphoneInvalid = null;
 
     #[ORM\Column(type: 'phone_number', nullable: true)]
     private ?PhoneNumber $mobilPhone = null;
 
-    #[ORM\Column(length: 255, nullable: true)]
+    #[ORM\Column(length: 30, nullable: true)]
     private ?string $mobilPhoneInvalid = null;
 
     #[ORM\ManyToMany(targetEntity: Organization::class, inversedBy: 'contactPoints')]

+ 1 - 0
src/Entity/Core/Country.php

@@ -20,6 +20,7 @@ use Doctrine\ORM\Mapping as ORM;
 )]
 // #[Auditable]
 #[ORM\Entity(repositoryClass: CountryRepository::class)]
+#[ORM\Table(indexes: [new ORM\Index(name: "name_idx", columns: ["name"])])]
 class Country
 {
     #[ORM\Id]

+ 1 - 1
src/Entity/Education/EducationNotationConfig.php

@@ -47,7 +47,7 @@ class EducationNotationConfig
     #[ORM\Column(type: 'text', nullable: true)]
     private ?string $description;
 
-    #[ORM\Column(options: ['default' => 1])]
+    #[ORM\Column(columnDefinition: "TINYINT DEFAULT 1 NOT NULL")]
     #[Assert\Range(notInRangeMessage: 'between_{{ min }}_and_{{ max }}', min: 1, max: 10)]
     private int $coefficient = 1;
 

+ 1 - 1
src/Entity/Message/ReportSms.php

@@ -27,7 +27,7 @@ class ReportSms extends AbstractReport
     //    #[ORM\Column(length: 255)]
     //    private string $mobile;
 
-    #[ORM\Column(nullable: true)]
+    #[ORM\Column(length: 15, nullable: true)]
     private ?string $smsId;
 
     public function getId(): ?int

+ 1 - 0
src/Entity/Organization/Organization.php

@@ -67,6 +67,7 @@ use JetBrains\PhpStorm\Pure;
 ])] //
 // #[Auditable]
 #[ORM\Entity(repositoryClass: OrganizationRepository::class)]
+#[ORM\Table(indexes: [new ORM\Index(name: "name_idx", columns: ["name"])])]
 class Organization
 {
     use CreatedOnAndByTrait;

+ 3 - 3
src/Entity/Organization/Parameters.php

@@ -62,7 +62,7 @@ class Parameters
     #[ORM\Column(type: 'date', nullable: true)]
     private ?\DateTimeInterface $endCourseDate = null;
 
-    #[ORM\Column(options: ['default' => 20])]
+    #[ORM\Column(columnDefinition: "TINYINT DEFAULT 20 NOT NULL")]
     #[Assert\Range(notInRangeMessage: 'between_{{ min }}_and_{{ max }}', min: 0, max: 100)]
     private int $average = 20;
 
@@ -133,7 +133,7 @@ class Parameters
     #[ORM\Column(length: 255, nullable: false, enumType: BulletinCriteriaSortEnum::class, options: ['default' => BulletinCriteriaSortEnum::BY_CRITERIA_INSERT])]
     private ?BulletinCriteriaSortEnum $bulletinCriteriaSort = null;
 
-    #[ORM\Column(length: 255, nullable: true)]
+    #[ORM\Column(length: 100, nullable: true)]
     private ?string $usernameSMS = null;
 
     #[ORM\Column(length: 255, nullable: true)]
@@ -182,7 +182,7 @@ class Parameters
     #[ORM\Column(type: 'boolean', options: ['default' => false])]
     private bool $notifyAdministrationAbsence = false;
 
-    #[ORM\Column(options: ['default' => 2])]
+    #[ORM\Column(columnDefinition: "TINYINT DEFAULT 2 NOT NULL")]
     #[Assert\Range(notInRangeMessage: 'between_{{ min }}_and_{{ max }}', min: 2, max: 100)]
     private int $numberConsecutiveAbsences = 2;
 

+ 1 - 0
src/Entity/Organization/Subdomain.php

@@ -49,6 +49,7 @@ use Symfony\Component\Validator\Constraints as Assert;
 #[OrganizationDefaultValue(fieldName: 'organization')]
 #[UniqueEntity('subdomain')]
 #[ApiFilter(filterClass: SearchFilter::class, properties: ['subdomain' => 'exact'])]
+#[ORM\Table(indexes: [new ORM\Index(name: "subdomain_idx", columns: ["subdomain"])])]
 class Subdomain
 {
     #[ORM\Id]

+ 1 - 1
src/Entity/Person/AllowedIp.php

@@ -21,7 +21,7 @@ class AllowedIp
     #[ORM\ManyToOne(targetEntity: Person::class, inversedBy: 'allowedIps')]
     private Person $person;
 
-    #[ORM\Column(type: 'string', nullable: true)]
+    #[ORM\Column(type: 'string', length: 100, nullable: true)]
     private string $ipOrRange;
 
     public function getId(): int

+ 7 - 0
src/Entity/Person/Person.php

@@ -29,6 +29,13 @@ use Symfony\Component\Serializer\Annotation\Groups;
 #[ApiResource(operations: [])]
 // #[Auditable]
 #[ORM\Entity(repositoryClass: PersonRepository::class)]
+#[ORM\Table(
+    indexes: [
+        new ORM\Index(columns: ["username"], name: "username_idx"),
+        new ORM\Index(columns: ["name"], name: "name_idx"),
+        new ORM\Index(columns: ["givenName"], name: "givenName_idx"),
+    ]
+)]
 class Person implements UserInterface, PasswordAuthenticatedUserInterface
 {
     use CreatedOnAndByTrait;

+ 4 - 0
src/Entity/Person/PersonActivity.php

@@ -26,14 +26,18 @@ class PersonActivity
     #[ORM\Column]
     #[ORM\GeneratedValue]
     private ?int $id = null;
+
     #[ORM\Column(length: 255, nullable: true)]
     private ?string $complementSpeciality = null;
+
     #[ORM\ManyToOne(inversedBy: 'personActivity')]
     #[ORM\JoinColumn(nullable: false)]
     private ?Access $access = null;
+
     #[ORM\ManyToOne(inversedBy: 'personActivities')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
     private Activity $activity;
+
     #[ORM\ManyToOne]
     private EquipmentList $speciality;
 

+ 1 - 1
src/Entity/Place/PlaceControl.php

@@ -21,7 +21,7 @@ use Doctrine\ORM\Mapping as ORM;
 #[ORM\Table(name: 'Control')]
 class PlaceControl extends AbstractControl
 {
-    #[ORM\Column(length: 255, nullable: false)]
+    #[ORM\Column(length: 12, nullable: false)]
     protected string $discr = 'place';
 
     #[ORM\ManyToOne(inversedBy: 'controls')]

+ 1 - 1
src/Entity/Place/PlaceRepair.php

@@ -22,7 +22,7 @@ use Doctrine\ORM\Mapping as ORM;
 #[ORM\Table(name: 'Repair')]
 class PlaceRepair extends AbstractRepair
 {
-    #[ORM\Column(length: 255, nullable: false)]
+    #[ORM\Column(length: 12, nullable: false)]
     protected string $discr = 'place';
 
     #[ORM\ManyToOne(inversedBy: 'placeRepairProviders')]

+ 1 - 1
src/Entity/Place/RoomControl.php

@@ -20,7 +20,7 @@ use Doctrine\ORM\Mapping as ORM;
 #[ORM\Table(name: 'Control')]
 class RoomControl extends AbstractControl
 {
-    #[ORM\Column(length: 255, nullable: false)]
+    #[ORM\Column(length: 12, nullable: false)]
     private string $discr = 'room';
 
     #[ORM\ManyToOne(inversedBy: 'controls')]

+ 1 - 1
src/Entity/Place/RoomRepair.php

@@ -19,7 +19,7 @@ use Doctrine\ORM\Mapping as ORM;
 #[ORM\Table(name: 'Repair')]
 class RoomRepair extends AbstractRepair
 {
-    #[ORM\Column(length: 255, nullable: false)]
+    #[ORM\Column(length: 12, nullable: false)]
     private string $discr = 'room';
 
     #[ORM\ManyToOne(inversedBy: 'repairs')]

+ 1 - 1
src/Entity/Product/EquipmentControl.php

@@ -21,7 +21,7 @@ use Doctrine\ORM\Mapping as ORM;
 #[ORM\Table(name: 'Control')]
 class EquipmentControl extends AbstractControl
 {
-    #[ORM\Column(length: 255, nullable: false)]
+    #[ORM\Column(length: 12, nullable: false)]
     protected string $discr = 'equipment';
 
     #[ORM\ManyToOne(inversedBy: 'equipmentControl')]

+ 1 - 1
src/Entity/Product/EquipmentRepair.php

@@ -23,7 +23,7 @@ use Doctrine\ORM\Mapping as ORM;
 #[ORM\Table(name: 'Repair')]
 class EquipmentRepair extends AbstractRepair
 {
-    #[ORM\Column(length: 255, nullable: false)]
+    #[ORM\Column(length: 12, nullable: false)]
     protected string $discr = 'equipment';
 
     #[ORM\ManyToOne(inversedBy: 'equipmentRepairProviders')]

+ 2 - 2
src/Entity/Traits/ActivityYearTrait.php

@@ -8,10 +8,10 @@ use Doctrine\ORM\Mapping as ORM;
 
 trait ActivityYearTrait
 {
-    #[ORM\Column(nullable: true)]
+    #[ORM\Column(type: "smallint", nullable: true)]
     private ?int $startYear = null;
 
-    #[ORM\Column(nullable: true)]
+    #[ORM\Column(type: "smallint", nullable: true)]
     private ?int $endYear = null;
 
     public function getStartYear(): ?int