I'm trying to create a little "Project Manager" CMP using Migx, so far it's been confusing and frustrating documentation is not great and any examples I have found do not cover what I am trying to do.
Consider this schema:
<model package="projects" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" phpdoc-package="" phpdoc-subpackage="" version="1.1" >
<object class="Project" table="bigblock_project" extends="xPDOSimpleObject">
<field key="title" dbtype="char" precision="50" phptype="string" null="false" />
<field key="tenderdate" dbtype="datetime" phptype="datetime" null="true" />
<field key="description" dbtype="text" phptype="string" null="true" />
<field key="category" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" />
<field key="status" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="sqfoot" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="status" dbtype="char" precision="50" phptype="string" null="false" />
<field key="deleted" dbtype="int" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="published" dbtype="int" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="featured" dbtype="int" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<composite alias="ProjectDocument" class="ProjectDocument" local="id" foreign="project_id" cardinality="many" owner="local" />
<composite alias="ProjectImage" class="ProjectImage" local="id" foreign="project_id" cardinality="many" owner="local" />
<aggregate alias="ProjectCategory" class="ProjectCategory" local="category" foreign="id" cardinality="one" owner="foreign" />
<aggregate alias="ProjectStatus" class="ProjectStatus" local="status" foreign="id" cardinality="one" owner="foreign" />
</object>
<object class="ProjectCategory" table="bigblock_project_category" extends="xPDOSimpleObject">
<field key="category" dbtype="char" precision="50" phptype="string" null="false" />
<field key="sort" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
<aggregate alias="Project" class="Project" local="id" foreign="category" cardinality="many" owner="local" default="0" />
</object>
<object class="ProjectStatus" table="bigblock_project_status" extends="xPDOSimpleObject">
<field key="status" dbtype="char" precision="50" phptype="string" null="false" />
<field key="sort" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
<aggregate alias="Project" class="Project" local="id" foreign="status" cardinality="many" owner="local" />
</object>
<object class="ProjectDocument" table="bigblock_project_document" extends="xPDOSimpleObject">
<field key="project_id" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index" />
<field key="title" dbtype="char" precision="255" phptype="string" null="false" />
<field key="description" dbtype="text" phptype="string" null="true" />
<field key="category" dbtype="int" precision="10" phptype="integer" null="false" />
<field key="date" dbtype="datetime" phptype="datetime" null="true" />
<field key="jsondata" dbtype="text" phptype="string" null="true" />
<field key="sort" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
<field key="document_mimetype" dbtype="char" precision="255" phptype="string" null="true" />
<field key="document_filename" dbtype="char" precision="255" phptype="string" null="false" />
<field key="document_filesize" dbtype="int" precision="100" phptype="integer" null="true" />
<field key="deleted" dbtype="int" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="published" dbtype="int" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<aggregate alias="Project" class="Project" local="project_id" foreign="id" cardinality="one" owner="foreign" />
<aggregate alias="DocumentCategory" class="DocumentCategory" local="category" foreign="id" cardinality="one" owner="foreign" />
</object>
<object class="DocumentCategory" table="bigblock_project_doc_category" extends="xPDOSimpleObject">
<field key="category" dbtype="char" precision="50" phptype="string" null="false" />
<field key="sort" dbtype="char" precision="50" phptype="string" null="false" default="0" />
<aggregate alias="ProjectDocument" class="ProjectDocument" local="id" foreign="category" cardinality="many" owner="local" />
</object>
<object class="ProjectImage" table="bigblock_project_image" extends="xPDOSimpleObject">
<field key="project_id" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index" />
<field key="title" dbtype="char" precision="255" phptype="string" null="false" />
<field key="description" dbtype="text" phptype="string" null="true" />
<field key="cover" dbtype="enum" precision="'0','1'" phptype="string" null="false" default="0" />
<field key="date" dbtype="datetime" phptype="datetime" null="true" />
<field key="jsondata" dbtype="text" phptype="string" null="true" />
<field key="sort" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
<field key="document_mimetype" dbtype="char" precision="255" phptype="string" null="true" />
<field key="document_filename" dbtype="char" precision="255" phptype="string" null="false" />
<field key="document_filesize" dbtype="int" precision="100" phptype="integer" null="true" />
<field key="deleted" dbtype="int" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="published" dbtype="int" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<aggregate alias="Project" class="Project" local="project_id" foreign="id" cardinality="one" owner="foreign" />
</object>
</model>
Pretty straight forward, a table to hold the basic project info a couple joined tables to hold images and files plus a couple other little tables to hold options (like category drop downs etc)
I have this kind of working in the sense that I have the schema parsed, tables created, a CMP created (and working) it will add/remove/edit projects. That part was all pretty smooth sailing. But now I need to get those image and document tables working... I was assuming I could somehow create a new configuration for each & place the (editable) grid of items in a form tab.
Can this be done & how?
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525