Compare commits

...

5 Commits

Author SHA1 Message Date
Alexander M. Turek
35c44a5667 Backport type fixes for EntityListenerResolver (#9977) 2022-08-08 11:00:16 +02:00
Fran Moreno
0215b6b9fb Undeprecate LifecycleEventArgs (#9980)
Deprecating this class means that users using SA tools have to
update their code specifying the ObjectManager implementation.

Instead of this, dedicated classes for each event should be
created before deprecating this class.
2022-08-08 10:59:03 +02:00
Fran Moreno
cc9272f53f Update documentation to not use deprecated method (#9979) 2022-08-08 07:46:05 +00:00
Alexander M. Turek
e3e7f3c209 Update branch metadata (#9971) 2022-08-07 19:56:19 +02:00
Alexander M. Turek
c9870a3d82 Remove calls to deprecated Type::getName() (#9972) 2022-08-07 19:55:23 +02:00
17 changed files with 37 additions and 44 deletions

View File

@@ -12,21 +12,27 @@
"upcoming": true
},
{
"name": "2.13",
"branchName": "2.13.x",
"slug": "2.13",
"name": "2.14",
"branchName": "2.14.x",
"slug": "2.14",
"upcoming": true
},
{
"name": "2.12",
"branchName": "2.12.x",
"slug": "2.12",
"name": "2.13",
"branchName": "2.13.x",
"slug": "2.13",
"current": true,
"aliases": [
"current",
"stable"
]
},
{
"name": "2.12",
"branchName": "2.12.x",
"slug": "2.12",
"maintained": false
},
{
"name": "2.11",
"branchName": "2.11.x",

View File

@@ -1,7 +1,7 @@
| [3.0.x][3.0] | [2.13.x][2.13] | [2.12.x][2.12] |
| [3.0.x][3.0] | [2.14.x][2.14] | [2.13.x][2.13] |
|:----------------:|:----------------:|:----------:|
| [![Build status][3.0 image]][3.0] | [![Build status][2.13 image]][2.13] | [![Build status][2.12 image]][2.12] |
| [![Coverage Status][3.0 coverage image]][3.0 coverage]| [![Coverage Status][2.13 coverage image]][2.13 coverage] | [![Coverage Status][2.12 coverage image]][2.12 coverage] |
| [![Build status][3.0 image]][3.0] | [![Build status][2.14 image]][2.14] | [![Build status][2.13 image]][2.13] |
| [![Coverage Status][3.0 coverage image]][3.0 coverage]| [![Coverage Status][2.14 coverage image]][2.14 coverage] | [![Coverage Status][2.13 coverage image]][2.13 coverage] |
[<h1 align="center">🇺🇦 UKRAINE NEEDS YOUR HELP NOW!</h1>](https://www.doctrine-project.org/stop-war.html)
@@ -22,11 +22,11 @@ without requiring unnecessary code duplication.
[3.0]: https://github.com/doctrine/orm/tree/3.0.x
[3.0 coverage image]: https://codecov.io/gh/doctrine/orm/branch/3.0.x/graph/badge.svg
[3.0 coverage]: https://codecov.io/gh/doctrine/orm/branch/3.0.x
[2.14 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.14.x
[2.14]: https://github.com/doctrine/orm/tree/2.14.x
[2.14 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.14.x/graph/badge.svg
[2.14 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.14.x
[2.13 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.13.x
[2.13]: https://github.com/doctrine/orm/tree/2.13.x
[2.13 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.13.x/graph/badge.svg
[2.13 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.13.x
[2.12 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.12.x
[2.12]: https://github.com/doctrine/orm/tree/2.12.x
[2.12 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.12.x/graph/badge.svg
[2.12 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.12.x

View File

@@ -73,10 +73,6 @@ This method has been deprecated in:
It will be removed in 3.0. Use `getObjectManager()` instead.
## Deprecated `Doctrine\ORM\Event\LifecycleEventArgs` class
It will be removed in 3.0. Use `Doctrine\Persistence\Event\LifecycleEventArgs` instead.
## Prepare split of output walkers and tree walkers
In 3.0, `SqlWalker` and its child classes won't implement the `TreeWalker`

View File

@@ -214,8 +214,8 @@ This might look like this:
<?php
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Events;
use Doctrine\Persistence\Event\LifecycleEventArgs;
/**
* The BlockStrategyEventListener will initialize a strategy after the

View File

@@ -214,7 +214,7 @@ specific to a particular entity class's lifecycle.
<?php
use Doctrine\DBAL\Types\Types;
use Doctrine\Persistence\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\LifecycleEventArgs;
#[Entity]
#[HasLifecycleCallbacks]
@@ -541,7 +541,7 @@ mentioned sets. See this example:
{
public function onFlush(OnFlushEventArgs $eventArgs)
{
$em = $eventArgs->getEntityManager();
$em = $eventArgs->getObjectManager();
$uow = $em->getUnitOfWork();
foreach ($uow->getScheduledEntityInsertions() as $entity) {

View File

@@ -12,8 +12,6 @@ use Doctrine\Persistence\Event\LifecycleEventArgs as BaseLifecycleEventArgs;
* Lifecycle Events are triggered by the UnitOfWork during lifecycle transitions
* of entities.
*
* @deprecated This class will be removed in ORM 3.0. Use "\Doctrine\Persistence\Event\LifecycleEventArgs" instead.
*
* @extends BaseLifecycleEventArgs<EntityManagerInterface>
*/
class LifecycleEventArgs extends BaseLifecycleEventArgs

View File

@@ -30,9 +30,6 @@ class ListenersInvoker
*/
private $eventManager;
/**
* Initializes a new ListenersInvoker instance.
*/
public function __construct(EntityManagerInterface $em)
{
$this->eventManager = $em->getEventManager();
@@ -46,6 +43,7 @@ class ListenersInvoker
* @param string $eventName The entity lifecycle event.
*
* @return int Bitmask of subscribed event systems.
* @psalm-return int-mask-of<self::INVOKE_*>
*/
public function getSubscribedSystems(ClassMetadata $metadata, $eventName)
{
@@ -74,6 +72,7 @@ class ListenersInvoker
* @param object $entity The Entity on which the event occurred.
* @param EventArgs $event The Event args.
* @param int $invoke Bitmask to invoke listeners.
* @psalm-param int-mask-of<self::INVOKE_*> $invoke
*
* @return void
*/

View File

@@ -12,7 +12,7 @@ interface EntityListenerResolver
/**
* Clear all instances from the set, or a specific instance when given its identifier.
*
* @param string $className May be any arbitrary string. Name kept for BC only.
* @param string|null $className May be any arbitrary string. Name kept for BC only.
*
* @return void
*/
@@ -31,6 +31,8 @@ interface EntityListenerResolver
* Register a entity listener instance.
*
* @param object $object An entity listener
*
* @return void
*/
public function register($object);
}

View File

@@ -709,9 +709,6 @@
<InvalidStringClass occurrences="1">
<code>new $className()</code>
</InvalidStringClass>
<MissingReturnType occurrences="1">
<code>register</code>
</MissingReturnType>
<PropertyTypeCoercion occurrences="1">
<code>$this-&gt;instances</code>
</PropertyTypeCoercion>
@@ -963,11 +960,6 @@
<code>$columnPrefix</code>
</MissingParamType>
</file>
<file src="lib/Doctrine/ORM/Mapping/EntityListenerResolver.php">
<MissingReturnType occurrences="1">
<code>register</code>
</MissingReturnType>
</file>
<file src="lib/Doctrine/ORM/Mapping/EntityResult.php">
<MissingConstructor occurrences="2">
<code>$discriminatorColumn</code>

View File

@@ -29,7 +29,6 @@
<!-- Remove on 3.0.x -->
<referencedClass name="Doctrine\Common\Persistence\PersistentObject"/>
<referencedClass name="Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets"/>
<referencedClass name="Doctrine\ORM\Event\LifecycleEventArgs"/>
<referencedClass name="Doctrine\ORM\Exception\UnknownEntityNamespace"/>
<referencedClass name="Doctrine\ORM\Mapping\Driver\YamlDriver"/>
<referencedClass name="Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand"/>
@@ -69,7 +68,6 @@
<referencedMethod name="Doctrine\DBAL\Connection::getSchemaManager"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getGuidExpression"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::supportsForeignKeyConstraints"/>
<referencedMethod name="Doctrine\DBAL\Types\Type::getName"/>
<!-- Remove on 3.0.x -->
<referencedMethod name="Doctrine\DBAL\Schema\Schema::visit"/>
<referencedMethod name="Doctrine\ORM\Internal\Hydration\AbstractHydrator::hydrateRow"/>

View File

@@ -4,9 +4,9 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\Company;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\PrePersist;
use Doctrine\Persistence\Event\LifecycleEventArgs;
use function func_get_args;

View File

@@ -6,6 +6,7 @@ namespace Doctrine\Tests\ORM\Functional;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PreFlushEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Doctrine\ORM\Mapping\Column;
@@ -27,7 +28,6 @@ use Doctrine\ORM\Mapping\PreRemove;
use Doctrine\ORM\Mapping\PreUpdate;
use Doctrine\ORM\Mapping\Table;
use Doctrine\ORM\Query;
use Doctrine\Persistence\Event\LifecycleEventArgs;
use Doctrine\Tests\OrmFunctionalTestCase;
use function count;

View File

@@ -5,8 +5,8 @@ declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional;
use Doctrine\Common\Util\ClassUtils;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Events;
use Doctrine\Persistence\Event\LifecycleEventArgs;
use Doctrine\Tests\Models\CMS\CmsAddress;
use Doctrine\Tests\Models\CMS\CmsEmail;
use Doctrine\Tests\Models\CMS\CmsPhonenumber;

View File

@@ -5,9 +5,9 @@ declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional;
use Doctrine\Common\EventArgs;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PostFlushEventArgs;
use Doctrine\ORM\Events;
use Doctrine\Persistence\Event\LifecycleEventArgs;
use Doctrine\Tests\Models\Cache\Country;
use Doctrine\Tests\Models\Cache\State;
use Exception;

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
@@ -14,7 +15,6 @@ use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\OneToMany;
use Doctrine\ORM\Mapping\OneToOne;
use Doctrine\Persistence\Event\LifecycleEventArgs;
use Doctrine\Tests\OrmFunctionalTestCase;
use function in_array;

View File

@@ -138,9 +138,11 @@ class DDC2984DomainUserId
class DDC2984UserIdCustomDbalType extends StringType
{
private const TYPE_NAME = 'ddc2984_domain_user_id';
public function getName(): string
{
return 'ddc2984_domain_user_id';
return self::TYPE_NAME;
}
/**
@@ -167,7 +169,7 @@ class DDC2984UserIdCustomDbalType extends StringType
}
if (! $value instanceof DDC2984DomainUserId) {
throw ConversionException::conversionFailed($value, $this->getName());
throw ConversionException::conversionFailed($value, self::TYPE_NAME);
}
return $value->toString();

View File

@@ -6,6 +6,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
@@ -17,7 +18,6 @@ use Doctrine\ORM\Mapping\ManyToMany;
use Doctrine\ORM\Mapping\PostUpdate;
use Doctrine\ORM\Mapping\PreUpdate;
use Doctrine\ORM\Mapping\Table;
use Doctrine\Persistence\Event\LifecycleEventArgs;
use Doctrine\Tests\OrmFunctionalTestCase;
use function get_class;