From fe4b6d79ace8c3478405042f1d8aa0f79d08665f Mon Sep 17 00:00:00 2001 From: Mathieu Ducrot Date: Thu, 19 Sep 2024 17:23:32 +0200 Subject: [PATCH 1/2] Fix HistoryLogger missing STATUS_PROPERTY check on log update skip --- src/Logger/HistoryLogger.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Logger/HistoryLogger.php b/src/Logger/HistoryLogger.php index 70532f3..fa0b359 100644 --- a/src/Logger/HistoryLogger.php +++ b/src/Logger/HistoryLogger.php @@ -122,6 +122,7 @@ public function log(HistorizableInterface $entity, ?string $code = null, array $ if ( $code === self::UPDATED_CODE && !isset($history[self::DIFF_PROPERTY]) + && !isset($history[self::STATUS_PROPERTY]) && $this->title === null && $this->comment === null && $this->description === null From 655b5570087cd3a26a745a88d40911d9568126e3 Mon Sep 17 00:00:00 2001 From: Mathieu Ducrot Date: Thu, 19 Sep 2024 18:43:50 +0200 Subject: [PATCH 2/2] `NameableInterface::setName` add missing null case as it is mentioned on the trait + `NameableTrait::name` property scope set as protected + `PersonNameableTrait::getInitial` use mb_substr for string with first accentuated character --- CHANGELOG.md | 14 ++++++++++++++ CHANGELOG_add_trait_monthelable_and_created.md | 3 --- CHANGELOG_update_nelmio_security_doc.md | 2 -- src/Entity/NameableInterface.php | 2 +- src/Entity/NameableTrait.php | 2 +- src/Entity/PersonNameableTrait.php | 4 ++-- 6 files changed, 18 insertions(+), 9 deletions(-) delete mode 100644 CHANGELOG_add_trait_monthelable_and_created.md delete mode 100644 CHANGELOG_update_nelmio_security_doc.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 81bd0ff..cde9098 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ CHANGELOG for 1.x =================== +## v1.11.0 - (2024-09-19) +### Added +`CreatableTrait` Trait & interface with creation date +`MonthYearTrait` Trait & interface with numeric representation of a month and his numeric year. Useful for statistics purposes. + +### Changed +`README.md` update : Add missing nelmio security settings configuration (@lfortunier) + +### Fixed +- `HistoryLogger` add missing STATUS_PROPERTY check on **log** update skip +- `NameableInterface::setName` add missing null case as it is mentioned on the trait +- `NameableTrait::name` property scope set as protected +- `PersonNameableTrait::getInitial` use mb_substr for string with first accentuated character + ## v1.10.0 - (2024-08-28) ### Added - `ArrayUtils::hasDuplicateValue` + tests (@lfortunier) diff --git a/CHANGELOG_add_trait_monthelable_and_created.md b/CHANGELOG_add_trait_monthelable_and_created.md deleted file mode 100644 index 3f3824a..0000000 --- a/CHANGELOG_add_trait_monthelable_and_created.md +++ /dev/null @@ -1,3 +0,0 @@ -### Added -`Entity::CreatableTrait` Trait & interface with creation date -`Entity::MonthYearTrait` Trait & interface with numeric representation of a month and his numeric year. Useful for statistics purposes. diff --git a/CHANGELOG_update_nelmio_security_doc.md b/CHANGELOG_update_nelmio_security_doc.md deleted file mode 100644 index b0e882f..0000000 --- a/CHANGELOG_update_nelmio_security_doc.md +++ /dev/null @@ -1,2 +0,0 @@ -### Changed -`README.md` update : Add missing nelmio security settings configuration (@lfortunier) \ No newline at end of file diff --git a/src/Entity/NameableInterface.php b/src/Entity/NameableInterface.php index a992776..574fad9 100644 --- a/src/Entity/NameableInterface.php +++ b/src/Entity/NameableInterface.php @@ -6,5 +6,5 @@ interface NameableInterface { public function getName(): ?string; - public function setName(string $name): self; + public function setName(?string $name): self; } diff --git a/src/Entity/NameableTrait.php b/src/Entity/NameableTrait.php index 5b55c66..af79e2a 100644 --- a/src/Entity/NameableTrait.php +++ b/src/Entity/NameableTrait.php @@ -15,7 +15,7 @@ trait NameableTrait #[ORM\Column(length: 255)] #[Assert\Length(max: 255)] #[Assert\NotBlank] - private ?string $name = null; + protected ?string $name = null; public function getName(): ?string { diff --git a/src/Entity/PersonNameableTrait.php b/src/Entity/PersonNameableTrait.php index c0bb5ce..21756ce 100644 --- a/src/Entity/PersonNameableTrait.php +++ b/src/Entity/PersonNameableTrait.php @@ -37,8 +37,8 @@ public function getInitial(): string { return sprintf( '%s%s', - substr(trim($this->getFirstName()), 0, 1), - substr(trim($this->getLastName()), 0, 1) + mb_substr(trim($this->getFirstName()), 0, 1), + mb_substr(trim($this->getLastName()), 0, 1) ); }