Pimcore\Model\Element\Note::addData PHP Метод

addData() публичный Метод

public addData ( string $name, string $type, mixed $data )
$name string
$type string
$data mixed
    public function addData($name, $type, $data)
    {
        $this->data[$name] = ["type" => $type, "data" => $data];
    }

Usage Example

Пример #1
0
 /**
  * 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;
 }
All Usage Examples Of Pimcore\Model\Element\Note::addData