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

Files with namespace other than \ProcessWire won't compile #1987

Open
uiii opened this issue Aug 25, 2016 · 2 comments
Open

Files with namespace other than \ProcessWire won't compile #1987

uiii opened this issue Aug 25, 2016 · 2 comments

Comments

@uiii
Copy link

uiii commented Aug 25, 2016

In my module I have a separated php files which are in their own namespace but other than \ProcessWire. That is a problem because these files are not therefore compiled.

Look here: https://github.com/uiii/ProcessWire-FieldtypePDF/blob/ec18e7d731da8f2113e356688ec97334c393a5e9/FieldtypePDF/PagePDF.php

These files should be compiled as well. I'm not sure if it is complicated for you.

@uiii uiii changed the title Files with namespace other than \ProcessWire won't compile Files with namespace other than \ProcessWire won't compile Aug 25, 2016
@ryancramerdesign
Copy link
Owner

ProcessWire just supports compilation of modules that don't already have a namespace. The purpose of it is only to support that most PW 2.x modules continue to work in 3.x. Or to put it another way, the FileCompiler was built specifically to deal with non-namespaced files in order to make them compatible with the ProcessWire namespace. If it sees a file that already has a namespace, then it leaves it alone. I think the module you linked might be the only example I've seen of a 2.x module using namespaces in files that reference PW classes (which is good to see btw). If this were the case for lots and lots of modules, then no doubt we would have had to make the FileCompiler something entirely different than it is. So this is one case where the module probably has to be adjusted to support PW3. I've had to do the same with a couple of mine as well, and it's not unexpected for this to be the case now and then given the scope of the change between 2.x and 3.x. If I can be of any assistance in updating your module for PW3 support, please let me know and I'm happy to assist.

@uiii
Copy link
Author

uiii commented Aug 25, 2016

Yes, I understand the purpose of compiling and I agree.

The solution for my problem I see is to compile all files that have namespace other than \ProcessWire including no namespace. Will this be difficult or will it raise any issues?

So if I want to support PW 3.x as well as 2.x I have to get rid of the custom namespace or make two versions of the module?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants