-
MODX Staff
- 2,502 Posts
I wonder if there is any best approach or thoughts on how to go about converting 0.9.x.x snippets to Revolution. Certainly the API is a starting point but I wonder if there is some way to best do this?
Thanks for any help for a non-dev.
Jay
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub
-
MODX Staff
- 10,725 Posts
There will be a migration guide which will cover the topics that will be most important when converting. Unfortunately it’s way too much for a single post in the forum though.
However, look for direct SQL or calls to the DBAPI first and convert those to use PDO or the new xPDO objects representing the tables, where appropriate. In general SQL should be encapsulated in the classes of the model in a way that can be easily converted to another database engine. xPDO provides mysql-specific versions of those classes now; you just need to put platform-dependent SQL in those classes (or some of your own representing custom tables). Ultimately, snippets should call functions, instantiate objects, and call methods on those objects; this will make the platform much more maintainable and extensible moving forward, by abstracting the implementation of those functions from the code which makes use of them, allowing them to easily be changed without breaking anything.
The other thing is to start seeing which functions are deprecated, and finding ways to replace their usage. By doing this, developers can also help us better identify the methods that need to be available in various places in the core to support component building in the most robust and efficient way possible. I’m working on a major API documentation push and reviewing the API in total right now in fact to help do the same..
This is a good topic. I have a section on migrating to Revolution at bobsguides.com, but there is really nothing there on converting snippets.
My method has been to just paste the snippets in and run them and fix each problem that shows up in turn. That doesn’t address the fact that there are things that should be converted to the new Revolution way of doing things even though they work, though.