@mac
To disable returning other entities references when using Symfony 4, you can do the following steps:
- Open your config/packages/doctrine.yaml file.
- Under the doctrine key, search for the orm key. If it is not present, you can add it as follows:
doctrine:
orm:
# ...
- Under the orm key, add a new key called default_entity_manager if it does not exist:
doctrine:
orm:
default_entity_manager: default
# ...
- Under the default_entity_manager key, add a new key called naming_strategy if it does not exist:
doctrine:
orm:
default_entity_manager: default
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
# ...
- Under the naming_strategy key, add a new key called quote_strategy if it does not exist:
doctrine:
orm:
default_entity_manager: default
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
quote_strategy: doctrine.orm.quote_strategy.ansiquotesstrategy
# ...
- Under the quote_strategy key, add a new key called result_cache_driver with a value of null to disable caching:
doctrine:
orm:
default_entity_manager: default
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
quote_strategy: doctrine.orm.quote_strategy.ansiquotesstrategy
result_cache_driver: null
# ...
Save the changes and test your application. Now, when returning entities, references to other entities should be disabled.