Skip to content

Another way to resolve "No directory for Entity issue" #315

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

Conversation

yuriy-yakubskiy
Copy link

Here is actually yet another workaround idea as alternative to #311 to resolve issue with not loaded doctrine annotation metadata.
Just requiring file after entity is dumped to the file.

Also some tests are seems to be broken.
That's why they failing for #311 too.

yield 'entity_xml_mapping_error_existing' => [MakerTestDetails::createTest(

and

yield 'entity_xml_mapping_error_new_class' => [MakerTestDetails::createTest(

Annotation error asserted in those test was thrown not because metadata type is wrong but because for the issue we are trying to resolve.

:)

@@ -464,22 +453,9 @@ private function printAvailableTypes(ConsoleStyle $io)
$printSection($allTypes);
}

private function createEntityClassQuestion(string $questionText): Question
private function createEntityClassQuestion(string $questionText, bool $isFirstInteract = false): Question
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This 2nd arg isn't needed anymore

@yuriy-yakubskiy yuriy-yakubskiy force-pushed the make_entity_no_directory_fix branch from 0f90718 to 2baf318 Compare November 3, 2018 18:28
@weaverryan
Copy link
Member

Thanks for taking another attempt at this! It's much more complex than I expected :). Can you explain a bit more why the tests are failing? On master, the tests ARE currently passing. So why does this change cause those tests to fail?

@yuriy-yakubskiy
Copy link
Author

yuriy-yakubskiy commented Nov 3, 2018

  1. When I first tried to use maker-bundle on Symfony 3.4 and tried to create very first entity I got Annotation unsupported mapping error. It couldn't be a problem with mapping as I'm using annotations on my project.

today I cd to the test project for testing "MakeEntityXmlMappingError"
tests/tmp/cache/maker_app_a415fad3bbeef5284f98d1d9e50b9051 and manually debug issue with tests it appears that application throws error about not existing class relation that's why I removed the following line

<one-to-many field="avatars" target-entity="UserAvatar" mapped-by="user" />
.

Another test tries to create UserAvatarPhoto entity and expects that annotation error for existing user xml Entity will be thrown. But current code checks only Entity which is about to be generated.

@yuriy-yakubskiy yuriy-yakubskiy force-pushed the make_entity_no_directory_fix branch from 2baf318 to b357776 Compare November 3, 2018 18:50
@weaverryan
Copy link
Member

Ok, hmm, this helps. Question: if you revert your changes (i.e. use the master branch of this bundle), run the test, and then move into the test project for "MakeEntityXmlMappingError", do you get the error?

@yuriy-yakubskiy
Copy link
Author

yuriy-yakubskiy commented Nov 3, 2018

test

yes there is no such error which is weird.

Actually I know the answer this error is thrown after the fix and not thrown on master because after the fix DoctrineHelper:getEntitiesForAutocomplete() loads metadata before generating an Entity and application sees that there is an error in functional test metadata
namely not existing class relation
in xml mapping

<one-to-many field="avatars" target-entity="UserAvatar" mapped-by="user" />
and throws exception that mapping for not existing entity in user class :)

@weaverryan
Copy link
Member

Merged the other pull request - thanks!

@weaverryan weaverryan closed this Dec 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants