Assuming I create a new extra "MyExtra", there should be some directories inside MyExtra:
+MyExtra
+ _build
+ assets
+ core
+ components
+ myextra
+ docs
+ elements
+ model
+ myextra // default directory for main package (schema)
+ mysql // if we provide mysql schema
+ mssql // if we provide mssql schema
+ anotherpackagename // another directory for additional package (schema)
+ mysql
+ mssql
+ schema
- myextra.mysql.schema.xml
- myextra.mssql.schema.xml
- anotherpackagename.mysql.schema.xml
- anotherpackagename.mssql.schema.xml
Quote from: Everettg_99 at Dec 12, 2012, 09:48 PM
1. When creating the XML schema file, where should that file be saved and what naming conventions must it follow?
The file must be saved inside path/to/
MyExtra/core/components/myextra/model/schema/. There is no naming convention for filename, as long as it reflect the packageName in our shcema.
For example, the packageName "myextra" for MySQL should be saved as
myextra.mysql.schema.xml:
<model package="myextra" version="1.0.0" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM">
It's possible to have more than one schema in our extra, and each schema (packageName) will have it's own directory inside "model/" directory.
Quote from: Everettg_99 at Dec 12, 2012, 09:48 PM
2. Inside the XML schema file, what must be the names of the package and the object be? Does case matter?
The case matter. The packageName is better using all lowercase "myextra". But there are no naming convention for objectName. Below some example:
<model package="myextra" version="1.0.0" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM">
<object class="AnyObjectName" extends="modResource">
<composite alias="Children" class="OtherObjectName" local="id" foreign="parent" cardinality="many" owner="local" />
</object>
<object class="OtherObjectName" extends="modResource">
<aggregate alias="ParentDir" class="AnyObjectName" local="parent" foreign="id" cardinality="one" owner="foreign" />
<alias key="sku" field="menutitle" />
<alias key="images" field="introtext" />
</object>
</model>
Quote from: Everettg_99 at Dec 12, 2012, 09:48 PM
3. Where should the maps and class files end up? What is the logic of the structure here? It seems redundant to have smurf/model/smurf etc.
As mentioned above, the directory name for maps and
xpdoObjectClass depend on packageName in our schema.
Then there will be database specific
xpdoAbstractionLayerClass for our schema, and it will be saved in sub-directory "mysql" or "mssql" regarding the database we use.
If there are more than one schema, i.e.
anotherpackagename.mysql.schema.xml, it should be ended up in path/to/MyExtra/core/components/myextra/model/
anotherpackagename/.
Quote from: Everettg_99 at Dec 12, 2012, 09:48 PM
4. Is the addExtensionPackage method supposed to modify the extension_packages System Setting? Is there a benefit for editing the System Setting directly? And again, what's the naming convention there?
I guess there is no naming convention here. But previously when I try to create myextra_mysystemsetting1, myextra_mysystemsetting2 ... myextra_mysystemsettingN, it produces weird behavior when accessing System Setting page. The System Setting grid only showing 5 records even if I have more than 35 records and I can not get more then 1 page. (i don't know it's a feature or a bug).
So it's safe to create system setting using following format: myextra.mysystemsetting (using "dot" not "underscore").
[ed. note: lokamaya last edited this post 11 years, 4 months ago.]