and attempted both of the below
EE_Datetime::delete_related(array( array( ‘Event.EVT_ID’ => ‘3764’ )));
EEM_Datetime::delete_related(array( array( ‘Event.EVT_ID’ => ‘3764’ )));
They through the following error:
Deprecated: Non-static method EE_Base_Class::delete_related() should not be called statically
Any help with the correct use of this function would be great
The :: means you are trying to call a ‘static’ method on a class. The above calls the delete_related() method on the EE_Datetime class, but that method isn’t static. A ‘static method’ is a method (function) that is available on a class without the need to have an instance of that class.
To confuse things a little more, it is common to see methods that relate to a class written as above even though they are not static, why? Because it’s an easier way to show that method relates to the class (Yeah, I know it throws a spanner in the works).
So for your specific example you would use something like:
I’m not sure the above does what you are expect though, you may want to look at how the _permanently_delete_event() method removes the related data from the event, HERE.
Notice how it uses the EVent Object and pulls the related details from there.
Thank you Tony! That is exactly what I was looking for!
Viewing 2 reply threads
The support post ‘delete all associated datetime objects using EEM_Datetime::delete_related’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.