-
Notifications
You must be signed in to change notification settings - Fork 23
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
Troubles Namespacing WPGraphQL #66
Comments
Hey, I think I have this fixed: 49c444a Try the master branch and let me know: |
Reopening: the unit test passes but the integration test does not :( |
OK, I made further changes. 168 passing tests now! Let me know if it works for you. I get:
|
OH it's better... the global scope class is now prefixed correctly: final class EECD_WPGraphQL { however, the prefix is not applied consistently throughout the rest of the codebase, so everything fatals. For example, in the import is incorrect namespace MyProject\Dependencies\WPGraphQL\Registry\Utils;
use MyProject\Dependencies\WPGraphQL; and in the class code, the following code on line 181 is wrong : $allowed_taxonomies = WPGraphQL::get_allowed_taxonomies( 'objects' ); but then a little bit below that on line 203 it's correct : $taxonomies = \EECD_WPGraphQL::get_allowed_taxonomies(); so weird, since the two lines of code are almost identical. Looking at the source code repo, it appears that the inconsistency is in the code there: line 175: $allowed_taxonomies = WPGraphQL::get_allowed_taxonomies( 'objects' ); line 197 $taxonomies = \WPGraphQL::get_allowed_taxonomies(); so it appears that Strauss is getting tripped up when the globally scoped class is imported. Oh, and most importantly, THANK YOU so much for taking the time to work on this, it is so greatly appreaciated. |
I finally got this done. It's in master but not in a release yet: cbd1617 I replaced the Give it a try and let me know how it's working. |
Attempting to solve depedency conflicts with https://github.com/wp-graphql/wp-graphql
composer.json
results in a whole lot of weirdness with the WPGraphQL package ultimately not working.
The main WPGraphQL class is not namespaced, the top of the file DOES have the following commented out line added:
// Global. - namespace MyProject\Dependencies\WPGraphQL;
but the actual class declaration remains untouched:
whereas the expectation was for the class to either be namespaced via the namespace keyword or via the
classmap_prefix
prefix specified in composer.json.Either way, autoloading does not work and results in errors like:
which appears to be expecting the WPGraphQL to be namespaced like
MyProject\Dependencies\WPGraphQL
PLease note that the autoload file generated by straus is loaded during the very first few steps of my bootstrapping process:
Anyways, not sure whether my problems are caused by a bug, or due to misconfiguration, or if there is something else i failed to do.
Thank you in advance for all of your time, effort, and talent you have commited to this project. I'll gladly help write unit tests if any fix is needed to get this working.
The text was updated successfully, but these errors were encountered: