Forums / Developer / Object removed

Object removed

Author Message

Fabien Mas

Friday 23 February 2007 1:52:33 am

Hi,
I have my own class named "iag_quiz"
I have a specific table in my database to store the informations collected from the users
I need to delete those informations when a "iag_quiz" object is removed in the admin.

How can I intercept this event ?

Thx, Fabien

Fabien Mas

Monday 26 February 2007 5:01:47 am

nobody knows ?

Gurudutt Verma

Monday 26 February 2007 6:39:25 am

Hi Fabien,

I hope you have created new datatype to operate your table in database.
if yes then from your datatype yourdatatype.php you can add function

function deleteStoredObjectAttribute( &$objectAttribute, $version = null )
{
if( is_null( $version ) )
{
yourtableClass::removeRow( $var1, $var2 );
/*Here you can write to remove values from your custom table*/
}
}

for more information please have a look in
kernel/classes/ezdatatype.php

I hope this will help you.

Fabien Mas

Monday 26 February 2007 8:07:24 am

It works !
thx

It's just strange to use the new datatype... :)

Piotrek Karaƛ

Tuesday 13 January 2009 3:34:46 am

Gurudutt,

Your example saved me lots of confusion, as it underlines the necessity of ensuring null version, which wasn't explained anywhere else.

Thanks!

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu