
Doctrine ORM Basics
Entities, annotations, EntityManager, repositories, DQL, QueryBuilder, relationships
1What is Doctrine ORM in the context of Symfony?
What is Doctrine ORM in the context of Symfony?
Resposta
Doctrine ORM is an Object-Relational Mapper that allows manipulating database data through PHP objects. It abstracts SQL queries by providing an object layer, making code more maintainable and portable across different database management systems. It's the default recommended ORM with Symfony.
2Which PHP 8 attribute should be used to declare a class as a Doctrine entity?
Which PHP 8 attribute should be used to declare a class as a Doctrine entity?
Resposta
The #[ORM\Entity] attribute is used to indicate to Doctrine that a PHP class is an entity mapped to a database table. This attribute replaces comment-based annotations and is part of the Doctrine\ORM\Mapping namespace. It can be combined with repositoryClass to specify a custom repository.
3How to define an auto-incremented column as a primary key in a Doctrine entity?
How to define an auto-incremented column as a primary key in a Doctrine entity?
Resposta
To define an auto-incremented primary key, two attributes must be combined: #[ORM\Id] to mark the property as identifier, and #[ORM\GeneratedValue] to indicate the value will be automatically generated by the database. The default strategy is AUTO, which selects the appropriate method based on the DBMS.
What is the difference between persist() and flush() in EntityManager?
Which attribute should be used to map a string property to a VARCHAR column in Doctrine?
+22 perguntas de entrevista
Outros temas de entrevista Symfony
Modern PHP (8.1+)
Symfony Basics
Routing & Controllers
Twig & Templates
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
Custom Bundles
Microservices with Symfony
Real-time & WebSockets
Deployment & DevOps
Domine Symfony para sua proxima entrevista
Acesse todas as perguntas, flashcards, testes tecnicos, exercicios de code review e simuladores de entrevista.
Comece gratis