stable

Clone or download

Read-only

refactor: introduce SectionIdentifier

There are two issue with actual management of sections' id: 1. The UUID is build by the DAO and exposed. This is an issue because UUID lives under the `Tuleap\Db` namespace. We should not have a dependency on `Db` everywhere in the call stack. 2. The DAO deals with two different id. The UUID when an element is retrieved or inserted in the database. The string representation of the UUID when we want to retrieve a given section. For consistency and readability reasons, there should be only one representation. In order to fix those issues, we now have a `SectionIdentifier`. This identifier does not belong to the Db namespace and is passed everywhere needed in the call stack and built as soon as possible when the user query a section. This `SectionIdentifier` has still a dependency on `Tuleap\Db\UUID`. However its constructor is private, and its named constructor is internal and can only be used by `SectionIdentifierFactory`. This should limit misusage. No functional changes. Part of story #38288: add a new section Change-Id: I6e154aa4565e9f3aad049629a0250fec22537e3d

Modified Files

Name
M plugins/artidoc/include/Artidoc/Document/ArtidocDao.php +34 −36 Go to diff View file
M plugins/artidoc/include/Artidoc/Document/PaginatedRawSections.php +1 −2 Go to diff View file
A plugins/artidoc/include/Artidoc/Document/RawSection.php +49 −0 Go to diff View file
M plugins/artidoc/include/Artidoc/Document/SaveOneSection.php +3 −3 Go to diff View file
M plugins/artidoc/include/Artidoc/Document/SearchOneSection.php +2 −5 Go to diff View file
A plugins/artidoc/include/Artidoc/Document/Section/Identifier/InvalidSectionIdentifierStringException.php +31 −0 Go to diff View file
A plugins/artidoc/include/Artidoc/Document/Section/Identifier/SectionIdentifier.php +50 −0 Go to diff View file
A plugins/artidoc/include/Artidoc/Document/Section/Identifier/SectionIdentifierFactory.php +57 −0 Go to diff View file
M plugins/artidoc/include/Artidoc/REST/v1/ArtidocResource.php +11 −8 Go to diff View file
M plugins/artidoc/include/Artidoc/REST/v1/ArtidocSectionRepresentation.php +3 −3 Go to diff View file
M plugins/artidoc/include/Artidoc/REST/v1/ArtidocSectionRepresentationBuilder.php +4 −3 Go to diff View file
M plugins/artidoc/include/Artidoc/REST/v1/ArtidocSectionsResource.php +16 −2 Go to diff View file
M plugins/artidoc/include/Artidoc/REST/v1/POSTSectionHandler.php +16 −9 Go to diff View file
M plugins/artidoc/include/Artidoc/REST/v1/PUTSectionsHandler.php +9 −6 Go to diff View file
M plugins/artidoc/include/Artidoc/REST/v1/RawSectionsToRepresentationTransformer.php +9 −9 Go to diff View file
M plugins/artidoc/include/artidocPlugin.php +4 −2 Go to diff View file
M plugins/artidoc/tests/integration/Artidoc/Document/ArtidocDaoTest.php +32 −26 Go to diff View file
M plugins/artidoc/tests/unit/Artidoc/REST/v1/ArtidocSectionRepresentationBuilderTest.php +29 −21 Go to diff View file
M plugins/artidoc/tests/unit/Artidoc/REST/v1/POSTSectionHandlerTest.php +11 −11 Go to diff View file
M plugins/artidoc/tests/unit/Artidoc/REST/v1/PUTSectionsHandlerTest.php +5 −4 Go to diff View file
M plugins/artidoc/tests/unit/Artidoc/REST/v1/PaginatedArtidocSectionRepresentationCollectionBuilderTest.php +10 −9 Go to diff View file
M plugins/artidoc/tests/unit/Artidoc/REST/v1/RawSectionsToRepresentationTransformerTest.php +31 −32 Go to diff View file
M plugins/artidoc/tests/unit/Artidoc/Stubs/Document/SaveOneSectionStub.php +9 −9 Go to diff View file
M plugins/artidoc/tests/unit/Artidoc/Stubs/Document/SearchOneSectionStub.php +5 −3 Go to diff View file
A plugins/artidoc/tests/unit/Artidoc/Stubs/Document/SectionIdentifierStub.php +36 −0 Go to diff View file