-
Notifications
You must be signed in to change notification settings - Fork 53
Description
This is a bit of a longshot here, I'm using the laravel-adjacency-list package in my project. This package works by having a column on a model called parent_id, which when null denotes a root level item, then, models below it, loaded in via a children relationship may have an unlimited depth.
I have three models:
MarketingAutomationMarketingAutomationActionMarketingAutomationActionCondition
Based on these models, the MarketingAutomationAction is the model which contains the parent_id table and functionality around that package. In addition, this model also a foreign id column to marketing_automation_id.
MarketingAutomationActionCondition models are linked to actions. So in the end, we may end up with the following hierarchy:
- Marketing automation
- Marketing automation action
- Marketing automation action condition
- Marketing automation action condition
- Marketing automation action
- Marketing automation action
- Marketing automation action condition
- Marketing automation action
- Marketing automation action
- Marketing automation action
- Marketing automation action
- Marketing automation action
I've put \Bkwld\Cloner\Cloneable on all three of these models, then, I've added the following to each:
MarketingAutomation
protected $cloneable_relations = ['actions'];MarketingAutomationAction
protected $cloneable_relations = ['children', 'conditions'];When I attempt to clone an automation using MarketingAutomation::find(1)->duplicate(), the table structure of the. MarketingAutomationAction gets completely messed up, the parent_id column doesn't know how to relate to another model etc.
Any way to resolve this?