Share » Forums » Developer » Problems with related objects and 3.4.0

Problems with related objects and 3.4.0

Problems with related objects and 3.4.0

Wednesday 16 June 2004 4:22:36 pm - 4 replies

Author Message

Kåre Køhler Høvik

Monday 21 June 2004 8:00:36 am

The object relation list is not reflexive. To delete relation in both directions you need to delete both of them. Hope I understood your problem correctly.

--
Kåre Høvik

Kåre Høvik

Roberto Cespa

Wednesday 30 June 2004 3:37:14 pm

I apologize for the delay in this reply, but I spent a lot of time solving another problem with ez (&->& conversion, still not solved, but this would be off topic here).

I'm sorry, but I cannot understand your reply.
I have three objects A, B and C.

In the template (the public one, not in the admin), as I wrote before, I use the reverse_related_object_list property.
So A and B are related. Then I want to link B to C. Quite simple! And it works, if I browse on the site looking for C, I can find a link backwards to B.

Now, I decide that the relation between B and C is not correct anymore. So, I go to the admin side, edit object B and trash the relation with C.

On the public side, I browse to B and the "forward link" B->C is not there any more. Good!
Always on the public side, I browse to C and I still find the backward link C->B. Ouch!

This backward link is not present in the admin side. If I try to edit C, there is no related object at all.

Just note that even with the relation B->C, I'm not able to see the backward B<-C in the admin side. At least not with the standard admin templates.

Ciao,
Roberto

Kåre Køhler Høvik

Thursday 01 July 2004 1:12:17 am

Hi

Checked it, and it's caused by a bug. I fixed it in:
stable/3.2 rev. 6982
stable/3.2 rev. 6983
stable/3.2 rev. 6984
trunk rev. 6985

Fix :

Index: kernel/classes/ezcontentobject.php
===================================================================
--- kernel/classes/ezcontentobject.php  (revision 6983)
+++ kernel/classes/ezcontentobject.php  (working copy)
@@ -1632,7 +1632,8 @@
                                             WHERE
                                               ezcontentobject.id=ezcontentobject_link.from_contentobject_id AND
                                               ezcontentobject.status=" . EZ_CONTENT_OBJECT_STATUS_PUBLISHED . " AND
-                                              ezcontentobject_link.to_contentobject_id='$objectID'" );
+                                              ezcontentobject_link.to_contentobject_id='$objectID' AND
+                                              ezcontentobject_link.from_contentobject_version='$version'" );

         $return = array();

Thanks for reporting it.

--
Kåre Høvik

Kåre Høvik

Roberto Cespa

Thursday 01 July 2004 4:32:03 am

Thanx Kåre,
I've tried to correct those lines by hand but the relation is still there.
Honestly I did not spend many time trying to understand what is done by that piece of code... maybe the code will work with newly created objects....

Ciao,
Roberto

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu