Beispiel #1
0
 /**
  * Should handle execution of the task, taking as much (optional) parameters as needed
  *
  * The parameters should be optional and failing to provide them should be handled by
  * the task
  *
  * @param array $row Row to save
  */
 public function execute($row = null)
 {
     if ($row) {
         $batch = $this->getBatch();
         $batch->addToCounter('imported');
         // \MUtil_Echo::track($row);
         $this->targetModel->save($row);
         $batch->addToCounter('changed', $this->targetModel->getChanged());
     }
 }
Beispiel #2
0
 /**
  * Function to allow overruling of transform for certain models
  *
  * @param \MUtil_Model_ModelAbstract $model
  * @param \MUtil_Model_ModelAbstract $sub
  * @param array $data
  * @param array $join
  * @param string $name
  */
 protected function transformSaveSubModel(\MUtil_Model_ModelAbstract $model, \MUtil_Model_ModelAbstract $sub, array &$row, array $join, $name)
 {
     $keys = array();
     // Get the parent key values.
     foreach ($join as $parent => $child) {
         if (isset($row[$parent])) {
             $keys[$child] = $row[$parent];
         }
     }
     $row = $keys + $row;
     $saved = $sub->save($row);
     $row = $saved + $row;
 }