
Doctrine Advanced
Migrations, lifecycle callbacks, events, inheritance, custom types, performance optimization
1Which command generates a new Doctrine migration in Symfony?
Which command generates a new Doctrine migration in Symfony?
คำตอบ
The doctrine:migrations:diff command compares the current database schema with entity metadata and automatically generates a migration containing the differences. This is the recommended method for creating migrations as it avoids manual errors and ensures consistency between code and database.
2Which lifecycle callback is triggered before an entity is inserted into the database?
Which lifecycle callback is triggered before an entity is inserted into the database?
คำตอบ
The PrePersist callback is executed before a new entity is persisted to the database. This is the ideal place to initialize default values like creation timestamps or generate unique identifiers before insertion.
3How to enable lifecycle callbacks on a Doctrine entity?
How to enable lifecycle callbacks on a Doctrine entity?
คำตอบ
The HasLifecycleCallbacks attribute must be added to the entity class to enable callbacks. Without this attribute, methods annotated with PrePersist, PostUpdate and other callbacks will never be executed by Doctrine.
Which command executes all pending migrations in Doctrine?
Which Doctrine callback to use for automatically updating an 'updatedAt' field on each modification?
+21 คำถามสัมภาษณ์
หัวข้อสัมภาษณ์ Symfony อื่นๆ
Modern PHP (8.1+)
Symfony Basics
Routing & Controllers
Twig & Templates
Doctrine ORM Basics
Symfony Forms
Data Validation
Dependency Injection & Services
Security & Authentication
API Platform
Serializer Component
Events & Event Subscribers
Console & Commands
Messenger Component
HTTP Client
Cache & Performance
Workflow Component
Testing Symfony
Mailer Component
Translations & i18n
EasyAdmin Bundle
Symfony Architecture
Performance & Optimization
Security Advanced
Custom Bundles
Microservices with Symfony
Real-time & WebSockets
Deployment & DevOps
เชี่ยวชาญ Symfony สำหรับการสัมภาษณ์ครั้งถัดไป
เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์
เริ่มใช้ฟรี