Skip to content

Commit

Permalink
Refactoring CsvImportBehavior to properly dispatch beforeImport event
Browse files Browse the repository at this point in the history
  • Loading branch information
gmansilla committed Mar 12, 2014
1 parent 4fe9623 commit 52f2950
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Model/Behavior/CsvImportBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ public function importCSV(Model $Model, $file, $fixed = array(), $returnSaved =
'data' => $data
)
));
$Event = new CakeEvent(
'CsvImportBehavior.beforeImport',
$Model, array(
'data' => $data
)
);
$Model->getEventManager()->dispatch($Event);
$data = $Event->result;

if (method_exists($Model, 'beforeImport')) {
$data = $Model->beforeImport($data);
}
Expand Down

0 comments on commit 52f2950

Please sign in to comment.