That’s a question with only one sensible answer: it’s magic! I jest, but seriously, that is a rather all-encompassing question that is very difficult to answer without writing a manual. Let’s try and explore the specifics you mention below...
Yes, How Revolution exactly works?
Meaning and philosophy is subjective. Is that really what you are looking for? Meaning? I suppose the meaning is to improve the system, make it more maintainable, make it easier to customize without hacking, follow principles of object-oriented and pattern-based development, etc. Here is an old post that describes the motivations and design philosophy behind Revolution: http://modxcms.com/transforming-modx-oo-mvc-orm.html. Does that help?
I started learning and working with MODx new version, I searched and read many tutorials and docs about it and it’s coding instruction.
I found modx and xpdo documentations which introduce classes and details but couldn’t find bridges it means you explained all parts of a great system with details but there is no explanation about those philosophy. i really didn’t know how to join them for my purposes.
I read splittingred’s blog, he has written about coding in Revolution but he hasn’t told anything about meaning of steps.
Yes, it’s completely different, yet very much the same. But which "system of nested folders" are you asking about? Are you asking about the component structure he exemplified for maintaining and building components in Subversion (SVN)? I’m not clear on what you mean, but if that’s the question, this is a new concept being demonstrated for those that want to build and maintain their components the way we have chosen to do so as part of the core team.
Knowing previous version instruction is easier but Revolution is completely different.
summary, I want to know what is the system of nested folders, in splittingred’s snippet creation tutorial i didn’t know why the plenty of folders need, why is it impossible to place all files in a few folders with simpler instruction.
There are a number of differences, mostly afforded by the new object-oriented code that utilizes the xPDO foundation. The modResource class is the base class for any Resources (formerly Documents) that you will see in the manager tree, and can be extended to change the processing by supplying derivative classes. Are there specific questions about processing Resources you are looking for answers to? There is a lot to processing a Resource in Revolution and, as I said before, explaining all of it in detail would take a book. Let’s see if we can’t get this dialog focused on specific topics that are preventing you from understanding how it works enough to work with it.
i want to know how MODx Revolution works, what is difference with it’s behavior with process documents in Revolution and previous versions?
This is all a part of xPDO, which Revolution is built upon. A schema is an XML file which defines a database table, it’s fields, it’s indexes, and it’s relationships with other database tables. It is used to generate domain and relational models of your tables that can instantly be used to manage the objects represented by the data. All xPDO objects are derived from xPDOObject and xPDOSimpleObject is a simple extension that automatically adds an id column with auto_incremented keys to an object (i.e. extend xPDOSimpleObject if your table will have a numeric primary key column, otherwise extend xPDOObject). xPDOObject provides methods to get() and set() the column values, save() the object to a row in the table, retrieve related objects, and a whole lot more. This is generically known as an Object/Relational Mapping framework, or O/RM.
What is SCHEMA?
I found out that the schema creates a object to approach data of a DB table. so why should i use it? i can use select functions and get the table data too.
I guess it allow me to get database data without no connecting to DB, so i don’t need connecting information and it can do anywhere. and i guess it can be more secure because connecting and dealing with DB do automatically with a separate script and it does not depend on my probably unsecured scripting. yes?
and please tell me more about creating schema, how should i create it? why it extends (.e.g) xPDOSimpleObject?
and would you tell me more about model folder which has created for a Revolution component and contains schema xml file, a class and etc.
what is it exactly? why should it create?
I had the same problem at first. You need to make sure all of the paths are correct in your build/schema/build.x.php file (namely MODX_BASE_PATH and the path in the $modx->buildSchema call). Are there any errors after running the build file?
Thanks, i found out that SCHEMA is a feature for entering database data to an object system. you said i can update
schema if i make change in my table but HOW? the schema ran in package installation how should i update existing object after installing it? ( i have unsuccessful experiment to install sample component in tutorial and i have nothing in model dir and IT causes this question! )
The class file extends XPDOObject (or xPDOSimpleObject), and the map file contains the definition of your object (field size, type, name, attributes, etc). They are created (actually, transported) during the installation of a package.
and you talked about MODELs, you told model is a class and map to represent database tables in PHP. in existing
tutorial about creating component, there is model directory which contains two php files: x.class.php and x.map.inc.php.
does the x.class.php file contains the class which extended XPDOObject or XPDOSimpleObject in schema?
what is contents of x.map.inc.php?
are these files created by MODx and schema during component installation?
is contents of model directory for ME? or it is needed only for MODx to represents data and use created object?From what I understand, they’re required if you want to use xPDO in your projects (like the $modx->newQuery() and $modx->newObject() methods). You don’t *need* to use xPDO if you don’t want to, and instead you can use $modx->query() and $modx->prepare() with an SQL statement. One advantage of xPDO is the fact that xPDO escapes your data automatically, so there’s no need to worry about that part.
is representing db-table data with creating object by schema, useful (or necessary) for any db-accessing in snippets and addons? or it’s needed only for components or some special addons?
so if yes,I’m pretty sure there’s a way to generate a schema from a table definition, but personally I create it by hand (with a lot of copy and pasting). It’s not completely necessary to use xPDO, or to even package your snippets - they’re run just fine as a stand-alone snippet. Packaging just makes it much easier to distribute your components to others. Even if you package your components, you *still* don’t need to use xPDO... for example, the WayFinder snippet doesn’t use xPDO yet, it uses $modx->query() instead.
if i want use a custom & simple snippet or addon which wants to connect DB tables via schema, should i install it only as a package to create object by schema? or can/should i create class and map of my object manually?
and finally,Most likely there’s a way to generate a table from a schema, much like there’s a way to generate a schema from a table, using xPDO, but I think one of the xPDO guys might need to comment further...
How can i run (or use) schema manually for creating and/or updating my object? or probably all my thoughts are wrong and schema run (or use) only manually!!
sorry for many questions!
I will ask and solve it in it’s main topic!
I had the same problem at first. You need to make sure all of the paths are correct in your build/schema/build.x.php file (namely MODX_BASE_PATH and the path in the $modx->buildSchema call). Are there any errors after running the build file?