diff options
| author | polo <ordipolo@gmx.fr> | 2025-10-19 14:24:00 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-10-19 14:24:00 +0200 |
| commit | 61a907785d9382adeb2de05b4b080de1d270f6d0 (patch) | |
| tree | a29ba877c4ac2e50ec04445726c3e0c464cea2c7 /src/model/entities | |
| parent | c9aa2be60924fc32c2d3d4f62596ed7c786fe3c1 (diff) | |
| download | cms-61a907785d9382adeb2de05b4b080de1d270f6d0.tar.gz cms-61a907785d9382adeb2de05b4b080de1d270f6d0.tar.bz2 cms-61a907785d9382adeb2de05b4b080de1d270f6d0.zip | |
suppression champ file_path_mini dans Asset, nettoyage divers, résolution bug quand pas d'image de fond
Diffstat (limited to 'src/model/entities')
| -rw-r--r-- | src/model/entities/Asset.php | 12 | ||||
| -rw-r--r-- | src/model/entities/Node.php | 19 |
2 files changed, 2 insertions, 29 deletions
diff --git a/src/model/entities/Asset.php b/src/model/entities/Asset.php index df8c98b..e1071b4 100644 --- a/src/model/entities/Asset.php +++ b/src/model/entities/Asset.php | |||
| @@ -19,13 +19,10 @@ class Asset | |||
| 19 | #[ORM\Column(type: "string", length: 255, unique: true)] // nom d'image UNIQUE | 19 | #[ORM\Column(type: "string", length: 255, unique: true)] // nom d'image UNIQUE |
| 20 | private string $file_name; | 20 | private string $file_name; |
| 21 | 21 | ||
| 22 | // choisir un répertoire du genre /var/www/html/uploads/ de préférence hors de /src | 22 | // choisir un répertoire du genre /var/www/html/uploads/, au moins hors de /src |
| 23 | #[ORM\Column(type: "string", length: 255, unique: true, nullable: true)] | 23 | #[ORM\Column(type: "string", length: 255, unique: true, nullable: true)] |
| 24 | private ?string $file_path; | 24 | private ?string $file_path; |
| 25 | 25 | ||
| 26 | #[ORM\Column(type: "string", length: 255, unique: true, nullable: true)] | ||
| 27 | private ?string $file_path_mini; | ||
| 28 | |||
| 29 | #[ORM\Column(type: "string", length: 255, nullable: true)] | 26 | #[ORM\Column(type: "string", length: 255, nullable: true)] |
| 30 | private string $mime_type; // image/jpeg, image/png, etc | 27 | private string $mime_type; // image/jpeg, image/png, etc |
| 31 | 28 | ||
| @@ -44,11 +41,10 @@ class Asset | |||
| 44 | #[ORM\ManyToMany(targetEntity: NodeData::class, mappedBy: "assets")] | 41 | #[ORM\ManyToMany(targetEntity: NodeData::class, mappedBy: "assets")] |
| 45 | private $node_data; | 42 | private $node_data; |
| 46 | 43 | ||
| 47 | public function __construct(string $name, ?string $path, ?string $path_mini, string $mime_type, string $alt) | 44 | public function __construct(string $name, ?string $path, string $mime_type, string $alt) |
| 48 | { | 45 | { |
| 49 | $this->file_name = $name; | 46 | $this->file_name = $name; |
| 50 | $this->file_path = $path; | 47 | $this->file_path = $path; |
| 51 | $this->file_path_mini = $path_mini; | ||
| 52 | $this->mime_type = $mime_type; | 48 | $this->mime_type = $mime_type; |
| 53 | $this->alt = $alt; | 49 | $this->alt = $alt; |
| 54 | } | 50 | } |
| @@ -61,10 +57,6 @@ class Asset | |||
| 61 | { | 57 | { |
| 62 | return $this->file_path; | 58 | return $this->file_path; |
| 63 | } | 59 | } |
| 64 | public function getFilePathMini(): string | ||
| 65 | { | ||
| 66 | return $this->file_path_mini; | ||
| 67 | } | ||
| 68 | public function getAlt(): string | 60 | public function getAlt(): string |
| 69 | { | 61 | { |
| 70 | return $this->alt; | 62 | return $this->alt; |
diff --git a/src/model/entities/Node.php b/src/model/entities/Node.php index 76ef74b..2034b3d 100644 --- a/src/model/entities/Node.php +++ b/src/model/entities/Node.php | |||
| @@ -176,25 +176,6 @@ class Node | |||
| 176 | $this->sortChildren(false); | 176 | $this->sortChildren(false); |
| 177 | } | 177 | } |
| 178 | } | 178 | } |
| 179 | |||
| 180 | // remplacée par "ORDER BY a.date_time" en DQL | ||
| 181 | /*private function sortNews(bool $chrono = false) // affichage du plus récent au plus ancien par défaut | ||
| 182 | { | ||
| 183 | // tri par insertion similaire à Position::sortChildren | ||
| 184 | for($i = 1; $i < count($this->children); $i++){ | ||
| 185 | $tmp = $this->children[$i]; | ||
| 186 | $j = $i - 1; | ||
| 187 | |||
| 188 | $compare = $chrono ? fn($a, $b) => $a > $b : fn($a, $b) => $a < $b; | ||
| 189 | |||
| 190 | while($j >= 0 && $compare($this->children[$j]->getArticle()->getDateTime(), $tmp->getArticle()->getDateTime())){ | ||
| 191 | $this->children[$j + 1] = $this->children[$j]; | ||
| 192 | $j--; | ||
| 193 | } | ||
| 194 | $this->children[$j + 1] = $tmp; | ||
| 195 | } | ||
| 196 | }*/ | ||
| 197 | |||
| 198 | public function removeChild(self $child): void | 179 | public function removeChild(self $child): void |
| 199 | { | 180 | { |
| 200 | foreach($this->children as $key => $object){ | 181 | foreach($this->children as $key => $object){ |
