APP_DEBUG=0 in .env means doctrine.dbal.profiling, which defaults to %kernel.debug%, was off in tests too, so doctrine.debug_data_holder was never registered. Every test calling countQueries() errored out — all four N+1 regression tests had been dead for as long as they have existed. Turning profiling on for when@test brings the harness back. Three of the four passed immediately. The fourth was a real N+1: the service-coverage endpoint batch-fetched its ServiceItem entities to avoid one find() per row, but ServiceItem maps staffMembers as fetch: EAGER, so hydrating N items fired N extra collection loads and the batch bought nothing. Six coverage rows cost 11 queries where one row cost 6. ServiceItemRepository::findUuidsByIds() returns the id => uuid map as a scalar query, so no entity is hydrated and no eager collection is touched. Also adds the query-count assertion for next_available_at that could not be written while the harness was broken. Confirmed it fails against the previous per-day implementation (40 queries for 2 locations, 113 for 6) and passes now. Suite: 411 tests, 2 failures — both pre-existing and unrelated (LowTierFixesTest, PatientWalletSessionSettleTest). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
53 lines
1.8 KiB
YAML
53 lines
1.8 KiB
YAML
doctrine:
|
|
dbal:
|
|
url: '%env(resolve:DATABASE_URL)%'
|
|
profiling_collect_backtrace: '%kernel.debug%'
|
|
use_savepoints: true
|
|
orm:
|
|
auto_generate_proxy_classes: true
|
|
enable_lazy_ghost_objects: true
|
|
report_fields_where_declared: true
|
|
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
|
|
auto_mapping: true
|
|
mappings:
|
|
App:
|
|
type: attribute
|
|
is_bundle: false
|
|
dir: '%kernel.project_dir%/src'
|
|
prefix: 'App'
|
|
alias: App
|
|
controller_resolver:
|
|
auto_mapping: false
|
|
dql:
|
|
string_functions:
|
|
JSON_CONTAINS: App\Shared\Doctrine\JsonContains
|
|
|
|
when@test:
|
|
doctrine:
|
|
dbal:
|
|
dbname_suffix: '_test%env(default::TEST_TOKEN)%'
|
|
# APP_DEBUG=0 در .env پروژه است، پس profiling که پیشفرضش %kernel.debug%
|
|
# است خاموش میماند و سرویس doctrine.debug_data_holder ساخته نمیشود.
|
|
# تستهای N+1 برای شمارش کوئری به آن نیاز دارند.
|
|
profiling: true
|
|
|
|
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
|