diff --git a/docs/en/_exts/configurationblock.py b/docs/en/_exts/configurationblock.py deleted file mode 100644 index c1d413643b1..00000000000 --- a/docs/en/_exts/configurationblock.py +++ /dev/null @@ -1,91 +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', - 'jinja': 'Twig', - 'html+jinja': 'Twig', - 'jinja+html': 'Twig', - 'php+html': 'PHP', - 'html+php': 'PHP', - 'ini': 'INI', - } - - 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 diff --git a/docs/en/tutorials/working-with-indexed-associations.rst b/docs/en/tutorials/working-with-indexed-associations.rst index ac326c4181f..e15cae87aa4 100644 --- a/docs/en/tutorials/working-with-indexed-associations.rst +++ b/docs/en/tutorials/working-with-indexed-associations.rst @@ -35,10 +35,6 @@ 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 - :language: yaml - - Inside the ``addStock()`` method you can see how we directly set the key of the association to the symbol, so that we can work with the indexed association directly after invoking ``addStock()``. Inside ``getStock($symbol)`` we pick a stock traded on the particular market by symbol. If this stock doesn't exist an exception is thrown. diff --git a/docs/en/tutorials/working-with-indexed-associations/market.yaml b/docs/en/tutorials/working-with-indexed-associations/market.yaml deleted file mode 100644 index b7c8132e090..00000000000 --- a/docs/en/tutorials/working-with-indexed-associations/market.yaml +++ /dev/null @@ -1,15 +0,0 @@ -Doctrine\Tests\Models\StockExchange\Market: - type: entity - id: - id: - type: integer - generator: - strategy: AUTO - fields: - name: - type:string - oneToMany: - stocks: - targetEntity: Stock - mappedBy: market - indexBy: symbol diff --git a/doctrine-mapping.xsd b/doctrine-mapping.xsd index 58175a2e8dd..6131026f5f6 100644 --- a/doctrine-mapping.xsd +++ b/doctrine-mapping.xsd @@ -321,7 +321,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] class DDC2700MappedSuperClass { - /** @var mixed */ #[Column] - private $foo; + private mixed $foo; } class MyNamespacedNamingStrategy extends DefaultNamingStrategy 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 @@ + + + + + + + + + + +