This question has been answered by multiple community members. See the first response.
... So just create a myCustomResourceData class which holds a reference to the resource ID.
I only had to add a plugin (with an OnEmptyTrash listener) which deletes the corresponding data in the myCustomResourceData object if a resource is deleted.Shouldn't that happen automatically if your schema for the custom resource class references your custom table?
I only had to add a plugin (with an OnEmptyTrash listener) which deletes the corresponding data in the myCustomResourceData object if a resource is deleted.Shouldn't that happen automatically if your schema for the custom resource class references your custom table?
<object class="GoodNewsResourceContainer" extends="modResource">
<composite alias="ResourceMailing" class="GoodNewsResourceMailing" local="id" foreign="parent" cardinality="many" owner="local" />
</object>
<object class="GoodNewsResourceMailing" extends="modResource">
<aggregate alias="ResourceContainer" class="GoodNewsResourceContainer" local="parent" foreign="id" cardinality="one" owner="foreign" />
</object>
<object class="GoodNewsMailingMeta" table="goodnews_mailing_meta" extends="xPDOSimpleObject">
<field key="mailing_id" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="groups" dbtype="text" phptype="string" null="false" default="" />
<field key="categories" dbtype="text" phptype="string" null="false" default="" />
<field key="recipients_list" dbtype="text" phptype="string" null="false" default="" />
<field key="test_recipients_list" dbtype="text" phptype="string" null="false" default="" />
<field key="recipients_total" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="recipients_sent" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="senton" dbtype="datetime" phptype="datetime" null="true" />
<field key="sentby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="finishedon" dbtype="datetime" phptype="datetime" null="true" />
<field key="ipc_status" dbtype="int" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<aggregate alias="SentBy" class="modUser" local="sentby" foreign="id" cardinality="one" owner="foreign" />
<aggregate alias="modResource" class="modResource" local="mailing_id" foreign="id" cardinality="one" owner="foreign" />
</object>
I only had to add a plugin (with an OnEmptyTrash listener) which deletes the corresponding data in the myCustomResourceData object if a resource is deleted.Shouldn't that happen automatically if your schema for the custom resource class references your custom table?
<object class="GoodNewsResourceContainer" extends="modResource">
<composite alias="ResourceMailing" class="GoodNewsResourceMailing" local="id" foreign="parent" cardinality="many" owner="local" />
</object>
<object class="GoodNewsResourceMailing" extends="modResource">
<aggregate alias="ResourceContainer" class="GoodNewsResourceContainer" local="parent" foreign="id" cardinality="one" owner="foreign" />
<composite alias="MailingMeta" class="GoodNewsMailingMeta" local="id" foreign="mailing_id" cardinality="one" owner="local" />
</object>
<object class="GoodNewsMailingMeta" table="goodnews_mailing_meta" extends="xPDOSimpleObject">
<field key="mailing_id" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="groups" dbtype="text" phptype="string" null="false" default="" />
<field key="categories" dbtype="text" phptype="string" null="false" default="" />
<field key="recipients_list" dbtype="text" phptype="string" null="false" default="" />
<field key="test_recipients_list" dbtype="text" phptype="string" null="false" default="" />
<field key="recipients_total" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="recipients_sent" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="senton" dbtype="datetime" phptype="datetime" null="true" />
<field key="sentby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="finishedon" dbtype="datetime" phptype="datetime" null="true" />
<field key="ipc_status" dbtype="int" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<aggregate alias="SentBy" class="modUser" local="sentby" foreign="id" cardinality="one" owner="foreign" />
<aggregate alias="ResourceMailing" class="GoodNewsResourceMailing" local="mailing_id" foreign="id" cardinality="one" owner="foreign" />
</object>