cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with associations

ruben_arjonilla
Champ in-the-making
Champ in-the-making
Hi,

I have a question about associations.
Let me give an example, I have these 2 types, A and B, where B defines an association of A type documents
<type name="x:a">
   <title>A</title>
   <parent>cm:content</parent>
   <properties>
      <property name="x:campo1">
         <title>campo 1</title>
         <description>Descripción campo 1</description>
         <type>d:text</type>
         <mandatory>false</mandatory>
         <default></default>
      </property>
   </properties>
</type>
<type name="x:b">
   <title>B</title>
   <parent>cm:content</parent>
   <properties>
      <property name="x:campo2">
         <title>campo 2</title>
         <description>Descripción campo 2</description>
         <type>d:text</type>
         <mandatory>false</mandatory>
         <default></default>
      </property>
   </properties>

   <associations>
      <association name="x:asocA">
         <title>Asociaciones con documentos A</title>
         <description>Asociación de documentos del tipo A</description>
         <source>
            <mandatory>false</mandatory>
            <many>true</many>
         </source>
         <target>
            <class>x:a</class>
            <mandatory>false</mandatory>
            <many>true</many>
         </target>
      </association>
   </associations>
</type>

Now imagine that I have a document of type A and a document of type B
A1.txt
B1.txt –> has an association with the document A1.txt

If I remove A1.txt, the association in B1.txt is still there,  but of course, can not find it because this document doesn't exists.
Is there any way that this association automatically is deleted when I delete A1.txt?

Thank you very much in advance.
2 REPLIES 2

openpj
Elite Collaborator
Elite Collaborator
You have to use Child Association for this, when you delete the primary parent all the children will be removed.
Hope this helps.

ruben_arjonilla
Champ in-the-making
Champ in-the-making
I want to remove the association, not the associated file.
My problem is that when I delete the file, it still exists in the archive SpaceStore.
When I can delete all files within archive SpaceStore, the association disappears, and the file associated is still there, that's what I wanted

thanks anyway