-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: clear entity persister on restoring class metadata (#264)
restoring the class metadata in the metadata factory does not restore the one doctrine has cached in the `class` property of it's persisters.... downstream this might lead to unexpected behaviour: when the id generator has been replaced with this library's `IdGenerator`, the basic entity persister does not recognise it as an id generator and treats the identity field as one which can be used for inserts in the [`BasicEntityPersister::getInsertColumnList`](https://github.com/doctrine/orm/blob/94144e122779098c156098fc9bb6791e53192086/src/Persisters/Entity/BasicEntityPersister.php#L1443-L1451) method this can lead to `Invalid parameter number: number of bound variables does not match number of tokens` errors on subsequent inserts of the entity manager. this change will fix that
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Fidry\AliceDataFixtures\Bridge\Doctrine\Entity; | ||
|
||
use Doctrine\ORM\Mapping\Column; | ||
use Doctrine\ORM\Mapping\Entity; | ||
use Doctrine\ORM\Mapping\GeneratedValue; | ||
use Doctrine\ORM\Mapping\Id; | ||
|
||
/** | ||
* @Entity | ||
*/ | ||
class DummyWithProperty | ||
{ | ||
/** | ||
* @Id | ||
* | ||
* @Column(type="integer") | ||
* | ||
* @GeneratedValue | ||
*/ | ||
public int $id; | ||
|
||
/** | ||
* @Column(type="string", name="property", nullable=true) | ||
*/ | ||
public ?string $property = null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters