docs
docs copied to clipboard
Add Webservice tutorial in (Modules) extension concept section
Add new page about how to extend the Webservice resources through custom entity and module
Questions | Answers |
---|---|
Branch? | 1.7.x |
Description? | Chatting with a community member that needs to add informations accessible through webservice, I discover that there isn't a small tutorial on how to do through a module with a custom entity (using ObjectModel). |
Fixed ticket? | ~ |
Thanks @marsaldev - I'll take a look this week ❤️
Hello @marsaldev
I'm not in favor to usage of namespace for classes that extends legacy PrestaShop Core classes like ObjectModel.
This classes were designed to be in the global namespace, use it with a namespace can create issues with others legacy classes, like native legacy logger : https://github.com/PrestaShop/PrestaShop/issues/28617
And also various others pieces of code that will interact with it in legacy PrestaShop core can encountered issues cause it were designed only for global namespace.
So my recommendation is to keep classes that's extends legacy PrestaShop core classes in global namespace, so put your ObjectModel in modules/yourmodule/classes/Article.php
All new classes that's not extends legacy classes can be namespaced and placed in modules/yourmodule/src/
without issue.
Hi @marsaldev
I agree with @Matt75.
It's been reported a few times that having legacy classes hidden behind namespaces may be problematic in some undocumented scenarios.
Let's keep it simple and focus on handling WS inside a class without having the composer handling autoloader, etc.
Got it! 😉 I'll update it 👍🏻 Thanks a lot @Matt75 @kpodemski
Thank you, @marsaldev ❤️ I allowed myself to commit some minor improvements. Let's wait for the build to see how it looks, if it is ok we will need to have it in the PrestaShop 8 too :)