LoginSignup
1
1

More than 5 years have passed since last update.

Doctrine2で管理されているエンティティを列挙する

Posted at

コントローラーで取得する場合は

$manager = $this->get('doctrine')->getManager();
foreach ($manager->getMetadataFactory()->getAllMetadata() as $meta) {
    var_dump(
        $meta->getName(),
        $meta->getReflectionClass()
    );
}

このような感じ。(実際にコントローラーで取る機会はないと思うけど)

ここで取れる $meta については
See: https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Persistence/Mapping/ClassMetadata.php
See: https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
などを参照

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1