/**
  * After we've been written, check whether we've got a template and to then
  * create the relevant actions etc.  
  */
 public function onAfterWrite()
 {
     parent::onAfterWrite();
     if ($this->numChildren() == 0 && $this->Template && !$this->TemplateVersion) {
         $this->workflowService->defineFromTemplate($this, $this->Template);
     }
 }
 /**
  * After we've been written, check whether we've got a template and to then
  * create the relevant actions etc.
  */
 public function onAfterWrite()
 {
     parent::onAfterWrite();
     // Request via ImportForm where TemplateVersion is already set, so unset it
     $posted = Controller::curr()->getRequest()->postVars();
     if (isset($posted['_CsvFile']) && $this->TemplateVersion) {
         $this->TemplateVersion = null;
     }
     if ($this->numChildren() == 0 && $this->Template && !$this->TemplateVersion) {
         $this->workflowService->defineFromTemplate($this, $this->Template);
     }
 }