Closed tn3rb closed 1 year ago
Hey, I think I have this fixed: https://github.com/BrianHenryIE/strauss/commit/49c444ace94720da2e93b85755c5557ba9fff57b
Try the master branch and let me know:
composer require brianhenryie/strauss:dev-master
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:
final class Prefix_WPGraphQL {
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 /Dependencies/wp-graphql/wp-graphql/src/Registry/Utils/PostObject.php
:
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: https://github.com/wp-graphql/wp-graphql/blob/develop/src/Registry/Utils/PostObject.php
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: https://github.com/BrianHenryIE/strauss/commit/cbd1617631bdb029f4660f2a9350dcfffb2b1db4
I replaced the use WPGraphQL;
with use Prefix_WPGraphQL as WPGraphQL;
, then by doing that before the namespace replacements, it wasn't inadvertently changed to use MyProject\Dependencies\WPGraphQL;
. Inside the class, WPGraphQL
and \Prefix_WPGraphQL
are both valid.
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:
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.