Pimcore\Model\Element\Note::save PHP Method

save() public method

public save ( )
    public function save()
    {
        // check if there's a valid user
        if (!$this->getUser()) {
            // try to use the logged in user
            if (\Pimcore::inAdmin()) {
                if ($user = \Pimcore\Tool\Admin::getCurrentUser()) {
                    $this->setUser($user->getId());
                }
            }
        }
        $this->getDao()->save();
    }

Usage Example

Example #1
0
 /**
  * @param $object
  * @param $title
  */
 public function addNoteOnObject($object, $title)
 {
     $note = new Model\Element\Note();
     $note->setElement($object);
     $note->setDate(time());
     $note->setType("newsletter");
     $note->setTitle($title);
     $note->setUser(0);
     $note->setData(["ip" => ["type" => "text", "data" => Tool::getClientIp()]]);
     $note->save();
 }
All Usage Examples Of Pimcore\Model\Element\Note::save