Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 3.4.x up into 4.0.x #11689

Merged
merged 9 commits into from
Oct 17, 2024
Merged
91 changes: 0 additions & 91 deletions docs/en/_exts/configurationblock.py

This file was deleted.

113 changes: 0 additions & 113 deletions docs/en/make.bat

This file was deleted.

4 changes: 0 additions & 4 deletions docs/en/tutorials/working-with-indexed-associations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 0 additions & 15 deletions docs/en/tutorials/working-with-indexed-associations/market.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion doctrine-mapping.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other"/>
</xs:choice>
<xs:attribute name="value" type="xs:NMTOKEN" use="required"/>
<xs:attribute name="value" type="orm:type" use="required"/>
<xs:attribute name="class" type="orm:fqcn" use="required"/>
<xs:anyAttribute namespace="##other"/>
</xs:complexType>
Expand Down
16 changes: 16 additions & 0 deletions tests/Tests/Models/Customer/CustomerType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace Doctrine\Tests\Models\Customer;

class CustomerType
{
/** @var string */
public $name;

public function __construct(string $name)
{
$this->name = $name;
}
}
13 changes: 13 additions & 0 deletions tests/Tests/Models/Customer/ExternalCustomer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Doctrine\Tests\Models\Customer;

final class ExternalCustomer extends CustomerType
{
public function __construct(string $name)
{
parent::__construct($name);
}
}
13 changes: 13 additions & 0 deletions tests/Tests/Models/Customer/InternalCustomer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Doctrine\Tests\Models\Customer;

final class InternalCustomer extends CustomerType
{
public function __construct(string $name)
{
parent::__construct($name);
}
}
19 changes: 17 additions & 2 deletions tests/Tests/ORM/Mapping/ClassMetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Doctrine\ORM\Mapping\DefaultNamingStrategy;
use Doctrine\ORM\Mapping\DefaultTypedFieldMapper;
use Doctrine\ORM\Mapping\DiscriminatorColumnMapping;
use Doctrine\ORM\Mapping\Driver\XmlDriver;
use Doctrine\ORM\Mapping\JoinTableMapping;
use Doctrine\ORM\Mapping\MappedSuperclass;
use Doctrine\ORM\Mapping\MappingException;
Expand All @@ -33,6 +34,7 @@
use Doctrine\Tests\Models\CMS\UserRepository;
use Doctrine\Tests\Models\Company\CompanyContract;
use Doctrine\Tests\Models\Company\CompanyContractListener;
use Doctrine\Tests\Models\Customer\CustomerType;
use Doctrine\Tests\Models\CustomType\CustomTypeParent;
use Doctrine\Tests\Models\DDC117\DDC117Article;
use Doctrine\Tests\Models\DDC117\DDC117ArticleDetails;
Expand Down Expand Up @@ -1080,14 +1082,27 @@ public function testItThrowsOnInvalidCallToGetAssociationMappedByTargetField():

$metadata->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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\Customer\CustomerType" table="customers" inheritance-type="SINGLE_TABLE">
<field name="name" column="name"/>
<discriminator-column name="type" type="string"/>
<discriminator-map>
<discriminator-mapping value="Doctrine\Tests\Models\Customer\InternalCustomer" class="Doctrine\Tests\Models\Customer\InternalCustomer" />
<discriminator-mapping value="Doctrine\Tests\Models\Customer\ExternalCustomer" class="Doctrine\Tests\Models\Customer\ExternalCustomer" />
</discriminator-map>
</entity>
</doctrine-mapping>