mailpoet
/
vendor-prefixed
/
doctrine
/
persistence
/
src
/
Persistence
/
Mapping
/
Driver
/
PHPDriver.php
mailpoet
/
vendor-prefixed
/
doctrine
/
persistence
/
src
/
Persistence
/
Mapping
/
Driver
Last commit date
ColocatedMappingDriver.php
9 months ago
DefaultFileLocator.php
9 months ago
FileDriver.php
9 months ago
FileLocator.php
9 months ago
MappingDriver.php
9 months ago
MappingDriverChain.php
9 months ago
PHPDriver.php
9 months ago
StaticPHPDriver.php
9 months ago
SymfonyFileLocator.php
9 months ago
index.php
3 years ago
PHPDriver.php
25 lines
| 1 | <?php |
| 2 | declare (strict_types=1); |
| 3 | namespace MailPoetVendor\Doctrine\Persistence\Mapping\Driver; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | use MailPoetVendor\Doctrine\Persistence\Mapping\ClassMetadata; |
| 6 | class PHPDriver extends FileDriver |
| 7 | { |
| 8 | protected $metadata; |
| 9 | public function __construct($locator) |
| 10 | { |
| 11 | parent::__construct($locator, '.php'); |
| 12 | } |
| 13 | public function loadMetadataForClass(string $className, ClassMetadata $metadata) |
| 14 | { |
| 15 | $this->metadata = $metadata; |
| 16 | $this->loadMappingFile($this->locator->findMappingFile($className)); |
| 17 | } |
| 18 | protected function loadMappingFile(string $file) |
| 19 | { |
| 20 | $metadata = $this->metadata; |
| 21 | include $file; |
| 22 | return [$metadata->getName() => $metadata]; |
| 23 | } |
| 24 | } |
| 25 |