-
-
Notifications
You must be signed in to change notification settings - Fork 204
Cannot resolve custom extension class #669
Comments
I don't want to give any conclusion but I am start to believe it's because of the case sensitive nature of ubuntu. I will try this on a ubuntu machine and see if I can reproduce this. |
Any update on this @wellingguzman? |
No update. I haven't worked on this yet. |
Hi, got any update on this? :) |
Hey @wellingguzman, |
@honzabilek4 Could it be that the autoload.php file doesn't read your newly created file? The autoload file is generated using authoritative class maps which doesn't read the actual file system but instead relies on a pre-made map of all the files that (should) be there. If you added a new file after that and try to load it in using Composer's autoload, it might fail. Could you try installing the dependencies using |
Well, yeah I've figured it out in the process 😆. This fixes the problem. I understand that this option might make the entire application faster, but it's not very convenient for deploying extensions. |
Gotcha! If it messes up deploying extensions, it's not a suitable way of building the API. I wish Composer has a way to have the best of both worlds? |
I believe the |
@honzabilek4 @wellingguzman Should I create the bundle without the |
I closed this ticket with some notes about reinstalling the I am going to add a note on update it when there's a |
@rijkvanzanten I don't know what actually |
@wellingguzman Normally, composer will read the file system and read the files based on that. The |
Since the
That's seems to be a pretty tedious process. I'm also not sure how to avoid this down time without redeploying the entire api instance. |
I think it’s important to make the extension development workflow more streamlined, so it’s easy to understand for other developers. Some additional info in the docs might help as well. |
We agree. @rijkvanzanten is starting in on the 7.1 refactor in a few days, so it'd be great to get as much input as possible into how the community thinks we should streamline the extensions, Docs, code structure — and therefore the development process. |
I will close this in favor of directus/directus#2273. As soon as that one is closed the issue will be also resolved. Any new related inconvenience should be discussed there to keep the discussion in one place. |
Hi,
I'm creating an extension class which will be called from Directus hook. Some code logic is omitted for simplicity.
public/extensions/custom/hooks/presentations/AfterCreatePresentation.php
And the hook is registered in
config/api.php
as:However the following error is being thrown:
It works perfectly on my system
MacOS
, but when deployed to production (Ubuntu
) it throws the error. I was tying to figure out some differences between the system and the most important is that Ubuntu is case-sensitive system, while MacOs is not. This would explain the not found problem. So I've tried to put the file in the folders named with uppercase/Custom/Hooks/Presentations
to help the autoloader find the class in the namespace, but with no effect.NOTE: The example hook for 'products' throws the same error when enabled.
The text was updated successfully, but these errors were encountered: