Forums / General / Object Relations / Comment32119

Author Topic

Gabriel Ambuehl

Friday 26 August 2005 4:00:41 pm

Comment32119

I can tell you WHY it happens:

SELECT
                                               count( ezcontentobject_link.from_contentobject_id ) as count
                                             FROM
                                               ezcontentobject,
                                               ezcontentobject_link
                                             WHERE
                                               ezcontentobject.id=ezcontentobject_link.to_contentobject_id AND
                                               ezcontentobject.status=1 AND
                                               ezcontentobject_link.from_contentobject_id='141' AND
                                               ezcontentobject_link.from_contentobject_version='1' AND
                           contentclassattribute_id=0

and similarly

SELECT count( DISTINCT ezcontentobject.id ) AS count
                                             FROM
                                               ezcontentobject, ezcontentobject_link
                                             WHERE
                                               ezcontentobject.id=ezcontentobject_link.from_contentobject_id AND
                                               ezcontentobject.status=1 AND
                                               ezcontentobject_link.to_contentobject_id=141 AND
                                               ezcontentobject_link.from_contentobject_version=ezcontentobject.current_version AND
                           ezcontentobject_link.contentclassattribute_id=0

Look at the last line of each query. Personally, I don't think it should be there, at all! Each object that points to some other object should list that fact, no matter if it's on the object or the attribute fact!

Visit http://triligon.org