
Custom Bundles
Bundle creation, extension configuration, compiler passes, reusable bundles, best practices
1Which class must the main bundle class extend in Symfony?
Which class must the main bundle class extend in Symfony?
Jawaban
The main bundle class in Symfony must extend AbstractBundle (Symfony 6.1+) or Bundle. AbstractBundle is recommended as it simplifies configuration and allows defining configuration directly in the bundle class via the configure() method. Bundle remains available for backward compatibility but AbstractBundle offers a more modern API.
2What is the role of the Extension class in a Symfony bundle?
What is the role of the Extension class in a Symfony bundle?
Jawaban
The Extension class (extending ConfigurableExtension or Extension) is responsible for loading the bundle configuration and registering services in the container. It reads the bundle's configuration files, processes application parameters, and configures services via the ContainerBuilder. It implements the load() method which is called during container compilation.
3What is the naming convention for the main class of a bundle named AcmePaymentBundle?
What is the naming convention for the main class of a bundle named AcmePaymentBundle?
Jawaban
By Symfony convention, the main bundle class must have the same name as the bundle. For AcmePaymentBundle, the main class will be AcmePaymentBundle and must be in the corresponding namespace, typically Acme\PaymentBundle. The file will therefore be AcmePaymentBundle.php in the bundle's src/ folder.
What is a Compiler Pass in Symfony and when should it be used?
How to define semantic configuration for a bundle with parameter validation?
+17 pertanyaan wawancara
Topik wawancara Symfony lainnya
Modern PHP (8.1+)
Symfony Basics
Routing & Controllers
Twig & Templates
Doctrine ORM Basics
Symfony Forms
Data Validation
Dependency Injection & Services
Security & Authentication
Doctrine Advanced
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
Microservices with Symfony
Real-time & WebSockets
Deployment & DevOps
Kuasai Symfony untuk wawancara berikutnya
Akses semua pertanyaan, flashcards, tes teknis, latihan code review dan simulator wawancara.
Mulai gratis