Glossary

← Glossary

Ashterix

docs(articles): English translation of From Magento to Symfony

en/articles/magento-to-symfony/basics/glossary.md new file +56 āˆ’0

1 + # Glossary
2 +
3 + The equivalents are approximate: where there is no direct counterpart, the note says what to do instead.
4 +
5 + | Magento 2 | Symfony | Note |
6 + |---|---|---|
7 + | Module: app/code/Vendor/Module, registration.php, module.xml | Namespace in src/; a Bundle only for reuse | Applications don't write bundles. Code is organized by domain: src/Faq, src/Checkout. |
8 + | module.xml <sequence> | config/bundles.php | Bundle order rarely matters. Flex adds them for you. |
9 + | Marketplace extension | Bundle via Composer + Flex recipe | The recipe creates config in config/packages and variables in .env. |
10 + | ObjectManager | Service Container | Compiled into a PHP class in var/cache. You can't fetch services from the container in code, only through the constructor. |
11 + | di.xml | config/services.yaml + attributes | Autowiring and autoconfiguration: most classes need no config at all. |
12 + | <preference> | alias, #[AsAlias] | If there is only one implementation, the alias is created automatically. |
13 + | virtualType | A separate service with its own id | Plus named autowiring: LoggerInterface $faqLogger. |
14 + | <type><arguments> | arguments, bind, #[Autowire] | Scalars, parameters, env, other services. |
15 + | shared="false" | shared: false | Services are shared by default, as in Magento. |
16 + | Generated Factory | new for entities; your own factory for services | Factories aren't generated. A Doctrine entity is created with new. |
17 + | Generated Proxy | lazy: true, #[Autowire(lazy: true)] | Lazy services without a separate class in the code. |
18 + | Plugin before/after/around | Decorator #[AsDecorator] or an event | Works at the level of a service and interface, not any method. |
19 + | Array of objects in di.xml (pool, list) | Tags + #[AutowireIterator] / #[AutowireLocator] | Implementations register themselves via #[AutoconfigureTag]. |
20 + | setup:di:compile | Container compilation, cache:warmup | In dev it rebuilds itself when files change. |
21 + | app/etc/env.php | .env, .env.local, environment variables | Real environment variables take precedence over files. |
22 + | app/etc/config.php (modules) | config/bundles.php | A bundle can be enabled for one environment only: ['dev' => true]. |
23 + | core_config_data, system.xml, ScopeConfig | Parameters, %env()%; your own table if needed | There are no admin settings with scopes. |
24 + | Developer / production modes | APP_ENV=dev / prod / test + APP_DEBUG | Per-environment config: when@prod in YAML. |
25 + | Area: frontend, adminhtml, webapi_rest | Firewall + route prefix | There is no separate "area". For CLI it's just a command. |
26 + | routes.xml + Controller/Index/Index.php | #[Route] on a controller method | One class can have several actions. You can make an invokable controller per action. |
27 + | ResultFactory: Page, Json, Redirect | Response, JsonResponse, RedirectResponse, $this->json() | A controller returns a Response. |
28 + | RequestInterface::getParam() | Request, #[MapQueryParameter], #[MapRequestPayload] | Controller arguments are filled in automatically. |
29 + | UrlInterface::getUrl() | UrlGeneratorInterface | URLs are generated by route name. |
30 + | URL rewrites, url_rewrite table | Routes with a slug | There is no rewrite table. The SEO URL is part of the route. |
31 + | events.xml + ObserverInterface | #[AsEventListener], EventSubscriberInterface | Priorities and stopping propagation are supported. |
32 + | String event name + data array | Event class; FQCN as the name | Typed data instead of DataObject. |
33 + | Model + ResourceModel + Collection | Entity + EntityManager + Repository | Data Mapper instead of Active Record. |
34 + | Repository + SearchCriteria | ServiceEntityRepository + QueryBuilder | Queries are written as explicit repository methods. |
35 + | $model->save() | persist() + flush() | flush() writes all changes, not a single entity. |
36 + | _beforeSave / _afterSave | Doctrine lifecycle events, #[AsEntityListener] | A separate Doctrine event dispatcher. |
37 + | db_schema.xml + whitelist | Mapping attributes + Doctrine Migrations | Migrations are imperative and versioned. diff is generated from the mapping. |
38 + | Schema / Data patches | Migrations (schema), Fixtures (test data) | Reference data for prod also goes into a migration. |
39 + | EAV | Columns, JSON columns, separate tables | There is no equivalent, and you usually don't need one. |
40 + | ResourceConnection, AdapterInterface | Doctrine DBAL Connection | For raw SQL and bulk operations. |
41 + | i18n/*.csv, __() | Translation: XLIFF/YAML, TranslatorInterface | translation:extract collects the keys. |
42 + | Validation in a service | Validator: #[Assert\...] on a DTO, #[MapRequestPayload] | Violations are returned to the client as a 422 with a list of errors. |
43 + | acl.xml, ADMIN_RESOURCE | Roles, access_control, Voter, #[IsGranted] | A Voter decides access to a specific object. |
44 + | Customer / admin session | Firewall, user provider, authenticator | The Security component. |
45 + | Integration tokens, OAuth | access_token authenticator, JWT bundle | For example, lexik/jwt-authentication-bundle. |
46 + | webapi.xml + service contracts | Controllers + Serializer or API Platform | Details are in [API and serialization](../data/api.md). |
47 + | Api/Data interfaces | DTOs (readonly classes) | #[MapRequestPayload] hydrates a DTO from the request body, Serializer handles the response. |
48 + | /swagger | OpenAPI: API Platform or NelmioApiDocBundle | Built from routes, types and attributes. |
49 + | GraphQL: schema.graphqls + resolvers | API Platform GraphQL, overblog/graphql-bundle | Separate bundles. |
50 + | communication.xml + queue_*.xml | Messenger: message + handler + routing | One DTO class, one handler, one line in messenger.yaml. |
51 + | crontab.xml | Scheduler: #[AsCronTask]; or system cron + a command | Scheduler runs through a Messenger worker. |
52 + | Cache types + tags | Cache pools + TagAwareCacheInterface | You can have as many pools as you like. |
53 + | Full Page Cache, Varnish | HTTP cache: headers, HttpCache, Varnish + FOSHttpCacheBundle | There is no FPC out of the box, there is standard HTTP caching. |
54 + | Logger via virtualType with handlers | Monolog channels in monolog.yaml | Autowiring by name: $faqLogger. |
55 + | Integration tests, @magentoDataFixture | KernelTestCase, WebTestCase, Foundry | Tests see private services through static::getContainer(). |
56 + | Indexers, mview | None; Messenger, Doctrine events, cron | You build denormalization explicitly. |