create() public static method

public static create ( array $values ) : Folder
$values array
return Folder
コード例 #1
0
 public function addFolderAction()
 {
     $success = false;
     $parent = Object::getById($this->getParam("parentId"));
     if ($parent->isAllowed("create")) {
         if (!Object\Service::pathExists($parent->getFullPath() . "/" . $this->getParam("key"))) {
             $folder = Object\Folder::create(array("o_parentId" => $this->getParam("parentId"), "o_creationDate" => time(), "o_userOwner" => $this->user->getId(), "o_userModification" => $this->user->getId(), "o_key" => $this->getParam("key"), "o_published" => true));
             $folder->setCreationDate(time());
             $folder->setUserOwner($this->getUser()->getId());
             $folder->setUserModification($this->getUser()->getId());
             try {
                 $folder->save();
                 $success = true;
             } catch (\Exception $e) {
                 $this->_helper->json(array("success" => false, "message" => $e->getMessage()));
             }
         }
     } else {
         \Logger::debug("prevented creating object id because of missing permissions");
     }
     $this->_helper->json(array("success" => $success));
 }
コード例 #2
0
ファイル: Installer.php プロジェクト: Pegasuz/member
 /**
  * @param string $key
  * @param AbstractObject|null $parent
  * @return Folder
  */
 public function createObjectFolder($key, $parent = null)
 {
     if ($parent instanceof AbstractObject) {
         $parent = $parent->getId();
     }
     $folder = Folder::create(array('o_parentId' => $parent !== null ? $parent : 1, 'o_creationDate' => time(), 'o_userOwner' => $this->getUser()->getId(), 'o_userModification' => $this->getUser()->getId(), 'o_key' => $key, 'o_published' => true));
     return $folder;
 }
コード例 #3
0
 public function createFolders()
 {
     $root = Folder::getByPath("/coreshop");
     $products = Folder::getByPath("/coreshop/products");
     $categories = Folder::getByPath("/coreshop/categories");
     $cart = Folder::getByPath("/coreshop/carts");
     $cartRules = Folder::getByPath("/coreshop/cart-rules");
     $countries = Folder::getByPath("/coreshop/countries");
     $currencies = Folder::getByPath("/coreshop/currencies");
     if (!$root instanceof Folder) {
         $root = Folder::create(array('o_parentId' => 1, 'o_creationDate' => time(), 'o_userOwner' => $this->_getUser()->getId(), 'o_userModification' => $this->_getUser()->getId(), 'o_key' => 'coreshop', 'o_published' => true));
     }
     if (!$products instanceof Folder) {
         Folder::create(array('o_parentId' => $root->getId(), 'o_creationDate' => time(), 'o_userOwner' => $this->_getUser()->getId(), 'o_userModification' => $this->_getUser()->getId(), 'o_key' => 'products', 'o_published' => true));
     }
     if (!$countries instanceof Folder) {
         Folder::create(array('o_parentId' => $root->getId(), 'o_creationDate' => time(), 'o_userOwner' => $this->_getUser()->getId(), 'o_userModification' => $this->_getUser()->getId(), 'o_key' => 'countries', 'o_published' => true));
     }
     if (!$currencies instanceof Folder) {
         Folder::create(array('o_parentId' => $root->getId(), 'o_creationDate' => time(), 'o_userOwner' => $this->_getUser()->getId(), 'o_userModification' => $this->_getUser()->getId(), 'o_key' => 'currencies', 'o_published' => true));
     }
     if (!$categories instanceof Folder) {
         Folder::create(array('o_parentId' => $root->getId(), 'o_creationDate' => time(), 'o_userOwner' => $this->_getUser()->getId(), 'o_userModification' => $this->_getUser()->getId(), 'o_key' => 'categories', 'o_published' => true));
     }
     if (!$cart instanceof Folder) {
         Folder::create(array('o_parentId' => $root->getId(), 'o_creationDate' => time(), 'o_userOwner' => $this->_getUser()->getId(), 'o_userModification' => $this->_getUser()->getId(), 'o_key' => 'carts', 'o_published' => true));
     }
     if (!$cartRules instanceof Folder) {
         Folder::create(array('o_parentId' => $root->getId(), 'o_creationDate' => time(), 'o_userOwner' => $this->_getUser()->getId(), 'o_userModification' => $this->_getUser()->getId(), 'o_key' => 'cart-rules', 'o_published' => true));
     }
     return $root;
 }