In my doctrine configuration I have disabled the auto_generate_proxy_classes
and enable_lazy_ghost_objects
, but still I am getting ghost objects.
The ghost object which I got is as follows
CreateFooBarOneGhost259bdb8
CreateFooBarTwoGhost2ecc09c
CreateFooBarThreeGhost1ea45a3
Here is my doctrine.yaml
parameters:
# Adds a fallback DATABASE_URL if the env var is not set.
# This allows you to run cache:warmup even if your
# environment variables are not available yet.
# You should not need to change this value.
env(DATABASE_URL): ''
doctrine:
dbal:
driver: 'pdo_mysql'
server_version: '10.4.14-MariaDB'
charset: utf8
default_table_options:
charset: utf8
collate: utf8_unicode_ci
schema_filter: ~^(?!session)~
url: '%env(DATABASE_URL)%'
options:
PDO::MYSQL_ATTR_LOCAL_INFILE: 1
PDO::ATTR_ERRMODE: 2
1002: "SET sql_mode=(SELECT
REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))"
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '16'
profiling_collect_backtrace: '%kernel.debug%'
use_savepoints: true
orm:
auto_generate_proxy_classes: false
enable_lazy_ghost_objects: false
controller_resolver:
auto_mapping: false
entity_managers:
default:
# Opt-in to new mapping driver mode as of Doctrine ORM 2.16, https://github.com/doctrine/orm/pull/10455
report_fields_where_declared: true
# 0pt-in to the new mapping driver mode as of Doctrine ORM 2.14. See https://github.com/doctrine/orm/pull/6728.
validate_xml_mapping: true
naming_strategy:
doctrine.orm.naming_strategy.default
auto_mapping: true
query_cache_driver:
pool: doctrine_query_pool
result_cache_driver:
pool: doctrine_result_pool
mappings:
gedmo_tree:
is_bundle: false
type: attribute
dir: "%kernel.project_dir%/vendor/gedmo/doctrine-extensions/src/Tree/Entity"
prefix: Gedmo\Tree\Entity
alias: GedmoTree
App:
is_bundle: false
type: attribute
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
hydrators:
ColumnHydrator: App\Doctrine\Hydrators\ColumnHydrator
when@test:
doctrine:
dbal:
# "TEST_TOKEN" is typically set by ParaTest
dbname_suffix: '_test%env(default::TEST_TOKEN)%'
when@prod:
doctrine:
orm:
auto_generate_proxy_classes: false
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool
framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system
Proxy/ghost objects will be generated anyway.
Those settings are to:
enable_lazy_ghost_objects
: disable the laziness of the proxies (which you shouldn't do, unless you know for sure that that setting is actually causing an issue).
auto_generate_proxy_classes
: to enable the automatic generation of proxies (as opposed to manual generation of proxies, when calling cache:clear
).
So, neither of these settings disables the creation of proxy objects (which are necessary for Doctrine to work correctly), but simply affects how and when are created.