From 73e30df52bae96f54e583b72074e67094197f5af Mon Sep 17 00:00:00 2001 From: MatteoFeltrin Date: Tue, 14 May 2024 15:06:47 +0200 Subject: [PATCH 1/3] allow classname in 'value' attribute of xml discriminator-mapping field --- doctrine-mapping.xsd | 2 +- tests/Tests/Models/Customer/CustomerType.php | 16 ++++++++++++++++ tests/Tests/Models/Customer/ExternalCustomer.php | 13 +++++++++++++ tests/Tests/Models/Customer/InternalCustomer.php | 13 +++++++++++++ tests/Tests/ORM/Mapping/ClassMetadataTest.php | 16 ++++++++++++++++ ...ne.Tests.Models.Customer.CustomerType.dcm.xml | 14 ++++++++++++++ 6 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 tests/Tests/Models/Customer/CustomerType.php create mode 100644 tests/Tests/Models/Customer/ExternalCustomer.php create mode 100644 tests/Tests/Models/Customer/InternalCustomer.php create mode 100644 tests/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.Customer.CustomerType.dcm.xml diff --git a/doctrine-mapping.xsd b/doctrine-mapping.xsd index a058787746c..651c9d29c09 100644 --- a/doctrine-mapping.xsd +++ b/doctrine-mapping.xsd @@ -375,7 +375,7 @@ - + diff --git a/tests/Tests/Models/Customer/CustomerType.php b/tests/Tests/Models/Customer/CustomerType.php new file mode 100644 index 00000000000..bd68c07ecf2 --- /dev/null +++ b/tests/Tests/Models/Customer/CustomerType.php @@ -0,0 +1,16 @@ +name = $name; + } +} diff --git a/tests/Tests/Models/Customer/ExternalCustomer.php b/tests/Tests/Models/Customer/ExternalCustomer.php new file mode 100644 index 00000000000..cf50d3e85e0 --- /dev/null +++ b/tests/Tests/Models/Customer/ExternalCustomer.php @@ -0,0 +1,13 @@ +getAssociationMappedByTargetField('foo'); } + + public function testClassNameMappingDiscriminatorValue(): void + { + $driver = new XmlDriver( + __DIR__ . '/xml', + XmlDriver::DEFAULT_FILE_EXTENSION, + true + ); + $xmlElement = $driver->getElement(CustomerType::class); + self::assertEquals( + 'Doctrine\Tests\Models\Customer\InternalCustomer', + $xmlElement->children()->{'discriminator-map'}->{'discriminator-mapping'}[0]->attributes()['value'] + ); + } } /** @MappedSuperclass */ diff --git a/tests/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.Customer.CustomerType.dcm.xml b/tests/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.Customer.CustomerType.dcm.xml new file mode 100644 index 00000000000..8767e3220a8 --- /dev/null +++ b/tests/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.Customer.CustomerType.dcm.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + From e47398ecc5eea7c6cc05e97c6086b1419298af59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 16 Oct 2024 22:08:16 +0200 Subject: [PATCH 2/3] Remove leftovers from Sphinx (#11683) We use phpDocumentor/guides now, no need for this. --- docs/en/_exts/configurationblock.py | 93 ----------------------- docs/en/make.bat | 113 ---------------------------- 2 files changed, 206 deletions(-) delete mode 100644 docs/en/_exts/configurationblock.py delete mode 100644 docs/en/make.bat diff --git a/docs/en/_exts/configurationblock.py b/docs/en/_exts/configurationblock.py deleted file mode 100644 index 36ca61f5b15..00000000000 --- a/docs/en/_exts/configurationblock.py +++ /dev/null @@ -1,93 +0,0 @@ -#Copyright (c) 2010 Fabien Potencier -# -#Permission is hereby granted, free of charge, to any person obtaining a copy -#of this software and associated documentation files (the "Software"), to deal -#in the Software without restriction, including without limitation the rights -#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -#copies of the Software, and to permit persons to whom the Software is furnished -#to do so, subject to the following conditions: -# -#The above copyright notice and this permission notice shall be included in all -#copies or substantial portions of the Software. -# -#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -#THE SOFTWARE. - -from docutils.parsers.rst import Directive, directives -from docutils import nodes -from string import upper - -class configurationblock(nodes.General, nodes.Element): - pass - -class ConfigurationBlock(Directive): - has_content = True - required_arguments = 0 - optional_arguments = 0 - final_argument_whitespace = True - option_spec = {} - formats = { - 'html': 'HTML', - 'xml': 'XML', - 'php': 'PHP', - 'yaml': 'YAML', - 'jinja': 'Twig', - 'html+jinja': 'Twig', - 'jinja+html': 'Twig', - 'php+html': 'PHP', - 'html+php': 'PHP', - 'ini': 'INI', - 'php-annotations': 'Annotations', - } - - def run(self): - env = self.state.document.settings.env - - node = nodes.Element() - node.document = self.state.document - self.state.nested_parse(self.content, self.content_offset, node) - - entries = [] - for i, child in enumerate(node): - if isinstance(child, nodes.literal_block): - # add a title (the language name) before each block - #targetid = "configuration-block-%d" % env.new_serialno('configuration-block') - #targetnode = nodes.target('', '', ids=[targetid]) - #targetnode.append(child) - - innernode = nodes.emphasis(self.formats[child['language']], self.formats[child['language']]) - - para = nodes.paragraph() - para += [innernode, child] - - entry = nodes.list_item('') - entry.append(para) - entries.append(entry) - - resultnode = configurationblock() - resultnode.append(nodes.bullet_list('', *entries)) - - return [resultnode] - -def visit_configurationblock_html(self, node): - self.body.append(self.starttag(node, 'div', CLASS='configuration-block')) - -def depart_configurationblock_html(self, node): - self.body.append('\n') - -def visit_configurationblock_latex(self, node): - pass - -def depart_configurationblock_latex(self, node): - pass - -def setup(app): - app.add_node(configurationblock, - html=(visit_configurationblock_html, depart_configurationblock_html), - latex=(visit_configurationblock_latex, depart_configurationblock_latex)) - app.add_directive('configuration-block', ConfigurationBlock) diff --git a/docs/en/make.bat b/docs/en/make.bat deleted file mode 100644 index 38fcba6007a..00000000000 --- a/docs/en/make.bat +++ /dev/null @@ -1,113 +0,0 @@ -@ECHO OFF - -REM Command file for Sphinx documentation - -set SPHINXBUILD=sphinx-build -set BUILDDIR=_build -set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . -if NOT "%PAPER%" == "" ( - set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% -) - -if "%1" == "" goto help - -if "%1" == "help" ( - :help - echo.Please use `make ^` where ^ is one of - echo. html to make standalone HTML files - echo. dirhtml to make HTML files named index.html in directories - echo. pickle to make pickle files - echo. json to make JSON files - echo. htmlhelp to make HTML files and a HTML help project - echo. qthelp to make HTML files and a qthelp project - echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter - echo. changes to make an overview over all changed/added/deprecated items - echo. linkcheck to check all external links for integrity - echo. doctest to run all doctests embedded in the documentation if enabled - goto end -) - -if "%1" == "clean" ( - for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i - del /q /s %BUILDDIR%\* - goto end -) - -if "%1" == "html" ( - %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/html. - goto end -) - -if "%1" == "dirhtml" ( - %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. - goto end -) - -if "%1" == "pickle" ( - %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle - echo. - echo.Build finished; now you can process the pickle files. - goto end -) - -if "%1" == "json" ( - %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json - echo. - echo.Build finished; now you can process the JSON files. - goto end -) - -if "%1" == "htmlhelp" ( - %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp - echo. - echo.Build finished; now you can run HTML Help Workshop with the ^ -.hhp project file in %BUILDDIR%/htmlhelp. - goto end -) - -if "%1" == "qthelp" ( - %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp - echo. - echo.Build finished; now you can run "qcollectiongenerator" with the ^ -.qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Doctrine2ORM.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Doctrine2ORM.ghc - goto end -) - -if "%1" == "latex" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - echo. - echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "changes" ( - %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes - echo. - echo.The overview file is in %BUILDDIR%/changes. - goto end -) - -if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck - echo. - echo.Link check complete; look for any errors in the above output ^ -or in %BUILDDIR%/linkcheck/output.txt. - goto end -) - -if "%1" == "doctest" ( - %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest - echo. - echo.Testing of doctests in the sources finished, look at the ^ -results in %BUILDDIR%/doctest/output.txt. - goto end -) - -:end From 182469b346f4de0677efccf43380e26b52eda568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 16 Oct 2024 22:59:19 +0200 Subject: [PATCH 3/3] Fix copy/paste/adapt mistake (#11684) The last step was missing. --- docs/en/tutorials/working-with-indexed-associations.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/tutorials/working-with-indexed-associations.rst b/docs/en/tutorials/working-with-indexed-associations.rst index 81032ee8e4a..e6822de3952 100644 --- a/docs/en/tutorials/working-with-indexed-associations.rst +++ b/docs/en/tutorials/working-with-indexed-associations.rst @@ -40,7 +40,7 @@ The code and mappings for the Market entity looks like this: .. literalinclude:: working-with-indexed-associations/market.xml :language: xml - .. literalinclude:: working-with-indexed-associations/market.xml + .. literalinclude:: working-with-indexed-associations/market.yaml :language: yaml