doctrine / doctrine/common

ProxyGenerator::isShortIdentifierGetter should check for file existance before reading the file

Open
#377 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
5.8k
Forks
284
PR merge metrics
No merged PRs in 30d

Description

We are using a module which is generating entity classes at runtime with Zend\Code\Generator which are only eval()'d and not persisted to the file system. When calling `doctrine-module orm:generate:proxies` lots of warnings are issued because the class files do not exist. Therefore, ProxyGenerator::isShortIdentifierGetter should check existance of class files before reading them with file().

Simply adding `&& file_exists($method->getDeclaringClass()->getFileName())` to the initialization of `$cheapCheck` does prevent those warnings.

Contributor guide

Open the contributing guide

Research direction

Start at ProxyGenerator::isShortIdentifierGetter and inspect how $cheapCheck obtains the declaring class file before calling file(). Reproduce with doctrine-module orm:generate:proxies using runtime-generated, non-persisted entity classes, then confirm the command completes without warnings for missing class files.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.