Skip to content
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

[FEATURE] Allow loading mappings from paths #41

Closed
wants to merge 3 commits into from

Conversation

FoxxMD
Copy link
Member

@FoxxMD FoxxMD commented Oct 24, 2016

Fluent will check the "paths" node in the doctrine config for an array of directories which it should load mapping files from

Changes proposed in this pull request:

  • Fluent will check the "paths" node in the doctrine config for an array of directories which it should load mapping files from and then load them

Fluent will check the "paths" node in the doctrine config for an array of directories which it should load mapping files from
$getting_namespace = $getting_class = false;

//Go through each token and evaluate it as necessary
foreach (token_get_all($contents) as $token) {
Copy link
Contributor

@guiwoda guiwoda Oct 24, 2016

Choose a reason for hiding this comment

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

@FoxxMD this is why I didn't add the file parser right away. Tokenizing a file's contents seems overkill, when the alternative is to list the FQCNs in the config and be done with it.
I'm not comfortable with the current solution, I don't know what @patrickbrouwers thinks about it.

Copy link
Member Author

@FoxxMD FoxxMD Oct 24, 2016

Choose a reason for hiding this comment

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

The alternative is adding 80+ lines to my doctrine config, for each manager. It gets unwieldy. Plus with paths I don't have to update my doctrine config each time I add a new mapping, just add the mapping and be done with it.

Copy link
Member Author

@FoxxMD FoxxMD Oct 24, 2016

Choose a reason for hiding this comment

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

Let me see if I can get doctrine's way to work...

Instead of tokenizing just require all files in paths and then use reflection and declared classes to find mapping classes
}

$sourceFile = realpath($file->getPathName());
require_once $sourceFile;
Copy link
Member Author

@FoxxMD FoxxMD Oct 24, 2016

Choose a reason for hiding this comment

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

@guiwoda This is how doctrine finds classes for the StaticPHPDriver

@patrickbrouwers
Copy link
Contributor

Keeping this open as reminder, but I'd prefer a different solution.

@patrickbrouwers
Copy link
Contributor

Replaced by #48

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.

3 participants