Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
env:
PHPUNIT_FLAGS: "-v"
SYMFONY_PHPUNIT_DIR: "$HOME/symfony-bridge/.phpunit"
COMPOSER_VERSION: 'v2'

jobs:
coding-standards:
Expand Down Expand Up @@ -131,12 +132,16 @@ jobs:
run: |
mysql --host 127.0.0.1 --port 3306 -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test_maker;"

- name: Use Legacy Composer?
if: ${{ matrix.php-version == '7.1.3' }}
run: echo 'COMPOSER_VERSION=2.2' >> "GITHUB_ENV"

- name: "Install PHP with extensions"
uses: shivammathur/[email protected]
with:
coverage: "none"
php-version: ${{ matrix.php-version }}
tools: composer:v2
tools: composer:${{ env.COMPOSER_VERSION }}

- name: "Add PHPUnit matcher"
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
Expand Down
1 change: 1 addition & 0 deletions WIP
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wip
31 changes: 29 additions & 2 deletions src/Doctrine/DoctrineHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Doctrine\Persistence\Mapping\AbstractClassMetadataFactory;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\Driver\AnnotationDriver;
use Doctrine\Persistence\Mapping\Driver\ColocatedMappingDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
use Doctrine\Persistence\Mapping\MappingException as PersistenceMappingException;
Expand Down Expand Up @@ -177,13 +178,39 @@ public function getEntitiesForAutocomplete(): array
*/
public function getMetadata(string $classOrNamespace = null, bool $disconnected = false)
{
$classNames = (new \ReflectionClass(AnnotationDriver::class))->getProperty('classNames');
$classNames->setAccessible(true);
// $aDriver = (new \ReflectionClass(\Doctrine\ORM\Mapping\Driver\AnnotationDriver::class))->getProperty('classNames');
// $aDriver->setAccessible(true);
//
// $bDriver = (new \ReflectionClass(AttributeDriver::class))->getProperty('classNames');
// $bDriver->setAccessible(true);
//
// if ($this->attributeMappingSupport && $this->isDoctrineSupportingAttributes()) {
// $classNames = $aDriver;
// } else {
// $classNames = $bDriver;
// }

// $colocated = new \ReflectionClass(ColocatedMappingDriver::class);
// $colocated->('classNames');

// dd($this->mappingDriversByPrefix, $this->attributeMappingSupport, $this->isDoctrineSupportingAttributes());


// $classNames = (new \ReflectionClass(AttributeDriver::class))->getProperty('classNames');
// $classNames->setAccessible(true);

// Invalidating the cached AnnotationDriver::$classNames to find new Entity classes
foreach ($this->mappingDriversByPrefix ?? [] as $managerName => $prefixes) {
foreach ($prefixes as [$prefix, $annotationDriver]) {
if (null !== $annotationDriver) {
if ($annotationDriver instanceof \Doctrine\ORM\Mapping\Driver\AnnotationDriver) {
$classNames = (new \ReflectionClass(\Doctrine\ORM\Mapping\Driver\AnnotationDriver::class))->getProperty('classNames');
$classNames->setAccessible(true);
} else {
$classNames = (new \ReflectionClass(AttributeDriver::class))->getProperty('classNames');
$classNames->setAccessible(true);
}

$classNames->setValue($annotationDriver, null);
}
}
Expand Down