-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support nette/robot-loader@3.0 #304
Conversation
There are two problems with robot loader 3.0 BC breaks RobotLoader::setCacheStorage() is removed
RobotLoader::$autoRebuild is private
|
yes i know, currently fixing it :-) |
@janatjak i fixed those bc breaks. do you know why it is failing now? |
@CzechBoy Check travis... btw IMHO using "$path/temp" directory is not good idea, because:
One question: Is your code compatible with robot-loader <= 3.0? New BC break? |
@janatjak Yes i know that it is not good idea for many reasons, but idk how to solve it in right way. And my app itself does not use robotloader. |
V ramci urychleni prejdu do cestiny. composer.json "nette/robot-loader": "3.0.2 as 2.4" Nova class class NewAnnotationDriver extends Doctrine\ORM\Mapping\Driver\AnnotationDriver
{
public function __construct(array $paths, Reader $reader)
{
parent::__construct($reader, $paths);
}
} Ve vlastnim ...
public function loadConfiguration()
{
$ormExtension = $this->compiler->getExtensions(OrmExtension::class)['doctrine'];
$ormExtension->metadataDriverClasses[OrmExtension::ANNOTATION_DRIVER] = NewAnnotationDriver::class;
} |
Ano, jak píšeš dočasně. Chtěl bych problém vyřešit a nezaseknout celej balík jenom na jedný jednosouborový závislosti. |
Because of conflict in dependency on nette/robot-loader between PHPStan and Kdyby/Doctine (see Kdyby/Doctrine#304), Kdyby package can't be installed.
I'm not quite sure why is RobotLoader even used in the AnnotationDriver. Do you guys know? I'd prefer to remove the RobotLoader dependency completely. |
@Majkl578 Yeah I found that... But I don't understand the purpose. I think it's some autoloading for proxies but why is such a thing necessary? |
@enumag I'm not sure entirely, but IMHO RobotLoader was simply the easiest way to get all classes in the given path. |
@@ -94,15 +95,20 @@ public function getFileExtensions() | |||
*/ | |||
protected function findAllClasses($path) | |||
{ | |||
$loader = new RobotLoader($this->cache !== NULL ? new ReversedStorageDecorator($this->cache) : new MemoryStorage()); | |||
$loader = new RobotLoader(); | |||
$loader->setTempDirectory("$path/temp"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm reading this correctly then this will create a temp dir in every directory configured for searching doctrine entities, right? The problem is that such directory can be set to read-only in production which is why I can't merge this PR.
so, we need get classes in path and remove dependency of nette/robot-loader ? We can try use Composer ClassLoader maybe ? |
You can't use Composer's classmap, it may not exist. But you can use similar approach Composer uses to scan directory for classes: https://github.com/composer/composer/blob/master/src/Composer/Autoload/ClassMapGenerator.php |
@Majkl578 Still why is some custom autoloading for proxies needed? I mean even Doctrine's native implementation would load them when needed, right? |
@enumag ok you mean We should create Kdyby/Doctrine classLoader ? |
@JanGalek I mean that I'd like to know why Doctrine's native implementation for proxies is not enough. |
@enumag ok, I added log when it calls, and it calls with orm:info, I tried comments our loading and output is same. This is call in MappingDescribeCommand too EDIT: |
@JanGalek Can you check if this test passes with the native implementation? |
@enumag I run test, fail: actual array(
'KdybyTests\\Doctrine\\AnnotationDriver\\App\\Bar',
'KdybyTests\\Doctrine\\AnnotationDriver\\App\\FooEntity',
'KdybyTests\\Doctrine\\AnnotationDriver\\Something\\Baz',
) expected array(
'KdybyTests\\Doctrine\\AnnotationDriver\\App\\FooEntity',
'KdybyTests\\Doctrine\\AnnotationDriver\\Something\\Baz',
) So I think that native not apply filter |
@enumag We need filter like |
@JanGalek Well apparently that's the reason for this. Whether we need it or not, personally I'd say no - it's a magic and if anyone needs it they can implement it outside of Kdyby/Doctrine. I'd like to simplify things in this package which in this case means to remove both the custom AnnotationDriver and robot-loader dependency. @fprochazka @Majkl578 Your opinions? |
I'd consider dropping the custom |
Good. Now I'm not talking to anyone in particular but if someone could send a PR with removal of |
Closed by #311. |
This change is