Skip to content

Commit

Permalink
Merge pull request #11686 from greg0ire/3.3.x
Browse files Browse the repository at this point in the history
Merge 2.20.x up into 3.3.x
  • Loading branch information
greg0ire authored Oct 16, 2024
2 parents 5aad44c + 94702d1 commit 9c0e62a
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 207 deletions.
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.

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>

0 comments on commit 9c0e62a

Please sign in to comment.