# Doctrine ORM の基礎 (Symfony) > Entities、annotations、EntityManager、repositories、DQL、QueryBuilder、relationships - 25 面接問題 - Junior - [面接問題: Symfony](https://sharpskill.dev/ja/technologies/symfony/interview-questions.md) ## 1. Symfony における Doctrine ORM とは何ですか? **回答** Doctrine ORM は Object-Relational Mapper であり、PHP オブジェクトを通じてデータベースのデータを操作できます。オブジェクト層を提供することで SQL クエリを抽象化し、コードをより保守しやすく、さまざまなデータベース管理システム間で移植可能にします。これは Symfony で推奨されるデフォルトの ORM です。 ## 2. クラスを Doctrine の entity として宣言するために使用すべき PHP 8 の attribute はどれですか? **回答** #[ORM\Entity] attribute は、PHP クラスがデータベーステーブルにマッピングされた entity であることを Doctrine に伝えるために使用されます。この attribute はコメントベースの annotations を置き換えるもので、Doctrine\ORM\Mapping namespace の一部です。repositoryClass と組み合わせてカスタム repository を指定することもできます。 ## 3. Doctrine の entity で自動採番されるカラムを primary key として定義するにはどうすればよいですか? **回答** 自動採番される primary key を定義するには、2 つの attributes を組み合わせる必要があります。プロパティを識別子としてマークする #[ORM\Id] と、値がデータベースによって自動生成されることを示す #[ORM\GeneratedValue] です。デフォルトの戦略は AUTO で、DBMS に応じて適切な方法を選択します。 ## さらに22問利用可能 - EntityManager における persist() と flush() の違いは何ですか? - Doctrine で string プロパティを VARCHAR カラムにマッピングするにはどの attribute を使用すべきですか? 無料で登録: https://sharpskill.dev/ja/login ## その他のSymfony面接トピック - [モダンPHP (8.1+)](https://sharpskill.dev/ja/technologies/symfony/interview-questions/php-modern-features.md): 20問, Junior - [Symfony の基礎](https://sharpskill.dev/ja/technologies/symfony/interview-questions/symfony-basics.md): 25問, Junior - [Routing & Controllers](https://sharpskill.dev/ja/technologies/symfony/interview-questions/routing-controllers.md): 20問, Junior - [Twig & Templates](https://sharpskill.dev/ja/technologies/symfony/interview-questions/twig-templates.md): 20問, Junior - [Symfony フォーム](https://sharpskill.dev/ja/technologies/symfony/interview-questions/forms.md): 22問, Junior - [データバリデーション](https://sharpskill.dev/ja/technologies/symfony/interview-questions/validation.md): 18問, Junior - [Dependency Injection & Services](https://sharpskill.dev/ja/technologies/symfony/interview-questions/dependency-injection.md): 24問, Mid-Level - [Security & Authentication](https://sharpskill.dev/ja/technologies/symfony/interview-questions/security-authentication.md): 26問, Mid-Level - [Doctrine 上級](https://sharpskill.dev/ja/technologies/symfony/interview-questions/doctrine-advanced.md): 24問, Mid-Level - [API Platform](https://sharpskill.dev/ja/technologies/symfony/interview-questions/api-platform.md): 22問, Mid-Level - [Serializer Component](https://sharpskill.dev/ja/technologies/symfony/interview-questions/serializer.md): 20問, Mid-Level - [Events & Event Subscribers](https://sharpskill.dev/ja/technologies/symfony/interview-questions/events-subscribers.md): 20問, Mid-Level - [Console & Commands](https://sharpskill.dev/ja/technologies/symfony/interview-questions/console-commands.md): 18問, Mid-Level - [Messenger Component](https://sharpskill.dev/ja/technologies/symfony/interview-questions/messenger.md): 22問, Mid-Level - [HTTP Client](https://sharpskill.dev/ja/technologies/symfony/interview-questions/http-client.md): 18問, Mid-Level - [キャッシュとパフォーマンス](https://sharpskill.dev/ja/technologies/symfony/interview-questions/cache.md): 20問, Mid-Level - [Workflow Component](https://sharpskill.dev/ja/technologies/symfony/interview-questions/workflow.md): 18問, Mid-Level - [Testing Symfony](https://sharpskill.dev/ja/technologies/symfony/interview-questions/testing.md): 22問, Mid-Level - [Mailer Component](https://sharpskill.dev/ja/technologies/symfony/interview-questions/mailer.md): 16問, Mid-Level - [翻訳と i18n](https://sharpskill.dev/ja/technologies/symfony/interview-questions/translations.md): 16問, Mid-Level - [EasyAdmin Bundle](https://sharpskill.dev/ja/technologies/symfony/interview-questions/easyadmin.md): 18問, Mid-Level - [Symfony アーキテクチャ](https://sharpskill.dev/ja/technologies/symfony/interview-questions/architecture-patterns.md): 24問, Senior - [パフォーマンスと最適化](https://sharpskill.dev/ja/technologies/symfony/interview-questions/performance-optimization.md): 22問, Senior - [高度なセキュリティ](https://sharpskill.dev/ja/technologies/symfony/interview-questions/security-advanced.md): 22問, Senior - [カスタムバンドル](https://sharpskill.dev/ja/technologies/symfony/interview-questions/custom-bundles.md): 20問, Senior - [Symfony によるマイクロサービス](https://sharpskill.dev/ja/technologies/symfony/interview-questions/microservices.md): 22問, Senior - [Real-time & WebSockets](https://sharpskill.dev/ja/technologies/symfony/interview-questions/real-time.md): 18問, Senior - [Deployment & DevOps](https://sharpskill.dev/ja/technologies/symfony/interview-questions/deployment-devops.md): 20問, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ja/technologies/symfony/interview-questions/doctrine-orm-basics