
Symfony Architecture
Hexagonal architecture, DDD, CQRS, repositories, DTOs, value objects, bounded contexts
1In hexagonal architecture, what is the main role of ports?
In hexagonal architecture, what is the main role of ports?
Answer
Ports are interfaces that define contracts between the business domain and the outside world. Primary ports (or driving ports) allow external actors to trigger actions in the domain, while secondary ports (or driven ports) allow the domain to interact with external infrastructure like databases or third-party services. This abstraction allows changing implementation without affecting the business domain.
2What is an adapter in Symfony hexagonal architecture?
What is an adapter in Symfony hexagonal architecture?
Answer
An adapter is a concrete implementation of a port that bridges the outside world and the domain. For example, a DoctrineUserRepository is an adapter implementing the UserRepositoryInterface port. On the primary side, a Symfony controller is an adapter that adapts HTTP requests to domain use cases. This separation allows testing the domain independently from infrastructure.
3In Domain-Driven Design, what is the main characteristic of a Value Object?
In Domain-Driven Design, what is the main characteristic of a Value Object?
Answer
A Value Object is defined by its attributes, not by an identity. Two Value Objects with the same values are considered equal. They are immutable: any modification creates a new instance. For example, an Email or Money object are typical Value Objects. This immutability ensures data consistency and makes reasoning about code easier in complex systems.
What is the role of an Aggregate Root in DDD?
What is a DTO (Data Transfer Object) and when to use it in Symfony?
+21 interview questions
Other Symfony interview topics
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
Performance & Optimization
Security Advanced
Custom Bundles
Microservices with Symfony
Real-time & WebSockets
Deployment & DevOps
Master Symfony for your next interview
Access all questions, flashcards, technical tests, code review exercises and interview simulators.
Start for free