Last active
December 7, 2017 14:47
-
-
Save FabienSalles/c67a9e828381bc737c6569387f286d7d to your computer and use it in GitHub Desktop.
Surchage entité doctrine
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
<?php | |
use Doctrine\ORM\Event\LoadClassMetadataEventArgs; | |
use Pim\Bundle\ApiBundle\Entity\AuthCode; | |
class AuthCodeMappingListener | |
{ | |
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs) | |
{ | |
$classMetadata = $eventArgs->getClassMetadata(); | |
if ($classMetadata->getName() !== AuthCode::class) { | |
return; | |
} | |
// Convert Pim\Bundle\ApiBundle\Entity\AuthCode to mappedSuperClass in order to avoid inheritance bugs | |
$classMetadata->isMappedSuperclass = true; | |
} | |
} |
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
Jardiland\Pim\Bundle\ApiBundle\Doctrine\ORM\EventListener\AuthCodeMappingListener: | |
tags: | |
- { name: doctrine.event_listener, event: loadClassMetadata } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Resolve relationship : https://symfony.com/doc/current/doctrine/resolve_target_entity.html