50 Posts
rtlehr
6 years ago
Topic

Hey there,

     I have all kinds of apps that rely on the parent to child relationship.  Is there a way to delete all the children when I use SEBLODs native delete?  If not, what is the best way to accomplish this?

Thank You,

Ross

Get a Book for SEBLOD
4229 Posts
Kadministrator
6 years ago
3
Level 1

Hi,

there is no way Seblod would automatically know what related items are, you would need to delete those items manually using afterStore code field and CckContent classes (see Manipulating content articles in Developer section https://www.seblod.com/resources/manuals )

50 Posts
rtlehr
6 years ago
2
Level 2

Thank you sir!!!

50 Posts
rtlehr
6 years ago
1
Level 3

Ok, so I have AfterSrore, I'm including it into the list, but it does not seem to executive when I hit the "delete" link associated with the article.  I'm trying to do something very simple in the AfterStore, just deleting another article.

$content = new JCckContentArticle;
$content->delete( 22 );

Is there somewhere special in the list I need to include the AfterStore to get it to execute? I've tried putting it in COLUMN-E and CLEAR.

Thank You,

Ross

215 Posts
iliil
6 years ago
0
Level 4

Hi Ross

If I understand what you want, I don't think AfterStore plugin will help you during the deletion process :)

First, how do you define parent/child in your app?  (perhaps custom SEBLOD field defining parent id ?)

You have to execute your code by onContentBeforeDelete event. Unfortunately, there is no BeforeDelete Seblod plugin available, so you have to create a simple Joomla content plugin.

In the plugin you can do something like this :

  1.  create onContentBeforeDelete method
  2.  in the method, check if the deleting article  is the correct SEBLOD Content type (DB table #__cck_core , item->id)
  3.  if it is, get an array of child article ID's you wish to delete.
  4.  for each ID,  delete the article using JCckContent class.

That works for me.

Best

Michal

Get a VIP membership