/**
* Creates a note for an action with a transition
* @param Element\AbstractElement $element
* @param string $type
* @param string $title
* @param string $description
* @param array $noteData
* @return Element\Note $note
*/
public static function createActionNote($element, $type, $title, $description, $noteData, $user = null)
{
//prepare some vars for creating the note
if (!$user) {
$user = \Pimcore\Tool\Admin::getCurrentUser();
}
$note = new Element\Note();
$note->setElement($element);
$note->setDate(time());
$note->setType($type);
$note->setTitle($title);
$note->setDescription($description);
$note->setUser($user->getId());
if (is_array($noteData)) {
foreach ($noteData as $row) {
$note->addData($row['key'], $row['type'], $row['value']);
}
}
$note->save();
return $note;
}