trigger_overhead_message = __('This trigger is called each time a Shadow Attribute is about to be saved. This means that when a large quantity of Shadow Attributes are being saved (e.g. Feed pulling or synchronisation), the workflow will be run for as many time as there are Shadow Attributes.'); } public function normalizeData(array $data) { $this->Event = ClassRegistry::init('Event'); $this->Attribute = ClassRegistry::init('Attribute'); if (empty($data['ShadowAttribute'])) { return false; } // If we're dealing with a proposed edit, we retrieve the data about the attribute if ($data['ShadowAttribute']['old_id']) { $event = $this->Attribute->fetchAttribute($data['ShadowAttribute']['old_id']); $event['Attribute']['ShadowAttribute'] = array($data['ShadowAttribute']); } else { // If it is a proposal to add a new attribute, we retrieve only the data about the event $event = $this->Event->quickFetchEvent($data['ShadowAttribute']['event_id']); $event['Event']['ShadowAttribute'] = [$data['ShadowAttribute']]; } $event = parent::normalizeData($event); return $event; } }