vendor/pimcore/pimcore/models/DataObject/Folder.php line 23

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Commercial License (PCL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  *  @license    http://www.pimcore.org/license     GPLv3 and PCL
  13.  */
  14. namespace Pimcore\Model\DataObject;
  15. use Pimcore\Model\DataObject;
  16. /**
  17.  * @method \Pimcore\Model\DataObject\Folder\Dao getDao()
  18.  */
  19. class Folder extends DataObject
  20. {
  21.     /**
  22.      * {@inheritdoc}
  23.      */
  24.     protected $o_type 'folder';
  25.     /**
  26.      * @param array $values
  27.      *
  28.      * @return Folder
  29.      */
  30.     public static function create($values)
  31.     {
  32.         $object = new static();
  33.         self::checkCreateData($values);
  34.         $object->setValues($values);
  35.         $object->save();
  36.         return $object;
  37.     }
  38.     /**
  39.      * {@inheritdoc}
  40.      */
  41.     protected function update($isUpdate null$params = [])
  42.     {
  43.         parent::update($isUpdate$params);
  44.         $this->getDao()->update($isUpdate);
  45.     }
  46.     /**
  47.      * {@inheritdoc}
  48.      */
  49.     public function delete()
  50.     {
  51.         if ($this->getId() == 1) {
  52.             throw new \Exception('root-node cannot be deleted');
  53.         }
  54.         parent::delete();
  55.     }
  56. }