Quote from: Black at Jun 11, 2010, 10:13 AMThough xPDO currently supports tables with compound primary keys, it does not support defining aggregate/composite relationships based on compound keys. For now, you may override xPDOObject methods in these classes to handle the unsupported relation definitions.
- Is this supported by xPDO?
- How should I define the composite relationship?
Would this do the trick?: <composite alias="table1" class="myTable1" local="colid1,colid2" foreign="colid1,colid2" cardinality="many" owner="local" />- How should I define the aggregate relationship?
Would this do the trick?: <aggregate alias="table2" class="myTable2" local="colid1,colid2" foreign="colid1,colid2" cardinality="one" owner="foreign" />
That said, I definitely believe support for this should be added. Can you enter a JIRA feature request for this so I don’t forget to add it to the xPDO roadmap?
<composite alias="table1" class="myTable1" local="colid1,colid2" foreign="colid1,colid2" cardinality="many" owner="local" /> and "<aggregate alias="table2" class="myTable2" local="colid1,colid2" foreign="colid1,colid2" cardinality="one" owner="foreign" />"

CREATE TABLE personne_metier ( ID_personne_metier INT NOT NULL IDENTITY CONSTRAINT PK_personne_metier PRIMARY KEY , ID_personne INT NOT NULL CONSTRAINT FK_personne_metier__ID_personne FOREIGN KEY (ID_personne) REFERENCES dbo.Liste , ID_metier INT NOT NULL CONSTRAINT FK_personne_metier__ID_metier FOREIGN KEY (ID_metier) REFERENCES dbo.metier , CONSTRAINT UQ_personne_metier__ID_personne__ID_metier UNIQUE (ID_personne, ID_metier) )
CREATE TABLE companies ( id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(80) NOT NULL, office VARCHAR(80) NOT NULL, description VARCHAR(255) NULL, email VARCHAR(45) NULL, website VARCHAR(80) NULL, PRIMARY KEY(id), UNIQUE(name, office) <-- HOW CAN I DO THIS IN MY XML SCHEMA ??? );
<object class="Company" table="companies" extends="xPDOSimpleObject">
<field key="name" dbtype="varchar" precision="80" phptype="string" null="false" default="" index="index" />
<field key="office" dbtype="varchar" precision="80" phptype="string" null="true" default="" index="index" />
<field key="description" dbtype="text" phptype="text" null="true" default="" />
<field key="email" dbtype="varchar" precision="255" phptype="string" null="true" default="" />
<field key="website" dbtype="varchar" precision="255" phptype="string" null="true" default="" />
</object>
<field key="name" dbtype="varchar" precision="80" phptype="string" null="false" default="" index="unique" indexgrp="nameoffice" /> <field key="office" dbtype="varchar" precision="80" phptype="string" null="true" default="" index="unique" indexgrp="nameoffice" />
<index alias="nameoffice" name="nameoffice" primary="false" unique="true">
<column key="name" collation="A" null="false" />
<column key="office" collation="A" null="false" />
</index>
thanks a lot... It will indeed be the same of all database engines; the implementation for mysql will be modified before 2.0.0-pl very soon.
I like the idea of an isolated index format... and love the way it works in the sqlite implementation you gave in example... Would it be the same for MySQL ?
Just an incomplete one at http://rtfm.modx.com/display/xPDO20/Defining+the+Database+and+Tables, but this definitely needs to be addressed. In addition, there will be an XML schema definition for the xPDO model schema files in the near future.
Other question, is there somewhere a doc (even a draft) with the list of all attributes properties for a field ?
