当前位置: 首页>>代码示例>>PHP>>正文


PHP Asset::create方法代码示例

本文整理汇总了PHP中Asset::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset::create方法的具体用法?PHP Asset::create怎么用?PHP Asset::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Asset的用法示例。


在下文中一共展示了Asset::create方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: importTerm

 protected function importTerm($node, $parentKey, $uriBase)
 {
     $attrs = $node->attributes();
     $id = strval($attrs->termID);
     if (!strlen($id)) {
         echo "Warning: Skipping Term with no termID\n";
         return;
     }
     $uri = $uriBase . ':' . $id;
     echo "Asset URL is " . $uri . "\n";
     $name = strval($node->Name);
     echo "Name is " . $name . "\n";
     $defn = strval($node->Definition);
     echo "Definition is " . $defn . "\n";
     if (!($asset = Asset::getByURL($this->db, $uri))) {
         $asset = Asset::create($this->db, $this->classname);
         echo "Created new term with key " . $asset->key . "\n";
         $asset->title = $name;
         $asset->description = $defn;
         $asset->url[] = $uri;
         if ($parentKey) {
             $asset->parent = $parentKey;
         }
         $asset->commit();
     } else {
         echo "Matched existing term with key " . $asset->key . "\n";
     }
     foreach ($node->Term as $term) {
         $this->importTerm($term, $asset->key, $uriBase);
     }
 }
开发者ID:nevali,项目名称:assets,代码行数:31,代码来源:tv-anytime.php

示例2: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Asset::create([]);
     }
 }
开发者ID:vanderlin,项目名称:halp,代码行数:7,代码来源:AssetsTableSeeder.php

示例3: create

 public static function create($db, $class = '')
 {
     if ($class == '') {
         $class = 'video';
     }
     return parent::create($db, $class);
 }
开发者ID:nevali,项目名称:assets,代码行数:7,代码来源:video.php

示例4: run

 /**
  * Auto generated seed file
  *
  * @return void
  */
 public function run()
 {
     \DB::table('assets')->delete();
     $brands = array('Dell', 'Asus', 'Acer', 'Samsung', 'Sony', 'HP');
     $rooms = DB::table('ceas_rooms')->lists('name');
     $dids = DB::table('department')->lists('id');
     $types = array('PC', 'Laptop', 'Monitor', 'TV', 'Server', 'Other');
     $faker = Faker\Factory::create();
     foreach (range(1, 25) as $id) {
         Asset::create(['brand_name' => $faker->randomElement($brands), 'room' => $faker->randomElement($rooms), 'active' => $faker->optional($weight = 0.4, $default = '1')->randomElement(array('0', '1')), 'mac_address' => $faker->macAddress, 'ip_address' => $faker->ipv4, 'assignee_name' => $faker->name, 'asset_type' => $faker->randomElement($types), 'department_id' => $faker->randomElement($dids), 'serial_number' => $faker->randomNumber(9), 'asset_tag' => $faker->md5, 'description' => $faker->realText(50)]);
     }
 }
开发者ID:p-tricky,项目名称:CAEWeb,代码行数:17,代码来源:AssetsTableSeeder.php

示例5: import

 public function import()
 {
     $this->asset = Asset::create($this->db, $this->classname);
     if (is_array($this->data)) {
         foreach ($this->data as $k => $v) {
             if (substr($k, 0, 1) == '_') {
                 continue;
             }
             $this->asset->{$k} = $v;
         }
     }
     $this->asset->commit();
     return $this->asset;
 }
开发者ID:nevali,项目名称:assets,代码行数:14,代码来源:marshal.php

示例6: getOrCreateAssetFolderByPath

 protected function getOrCreateAssetFolderByPath($path)
 {
     $folder = Asset_Folder::getByPath($path);
     if (!$folder instanceof Asset_Folder) {
         str_replace("\\", "/", $path);
         $parts = explode("/", $path);
         if (empty($parts[count($parts) - 1])) {
             $parts = array_slice($parts, 0, -1);
         }
         $parts = array_slice($parts, 1);
         $parentPath = "/";
         foreach ($parts as $part) {
             $parent = Asset_Folder::getByPath($parentPath);
             if ($parent instanceof Asset_Folder) {
                 $part = Pimcore_File::getValidFilename($part);
                 $folder = Asset_Folder::getByPath($parentPath . $part);
                 if (!$folder instanceof Asset_Folder) {
                     $folder = Asset::create($parent->getId(), array("filename" => $part, "type" => "folder", "userOwner" => $this->getUser()->getId(), "userModification" => $this->getUser()->getId()));
                 }
                 $parentPath .= $part . "/";
             } else {
                 Logger::error("parent not found!");
                 return null;
             }
         }
     }
     return $folder;
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:28,代码来源:AssetController.php

示例7: createLink

/**
* Creates a simple "TYPE 1" link between assets
*
* @param object	&$parent_asset	The parent asset
* @param object	&$child_asset	The child asset
*
* @return int
* @access public
*/
function createLink(Asset &$parent_asset, Asset &$child_asset)
{
    // Link the asset to the parent asset
    $link = array('asset' => &$parent_asset, 'link_type' => 1, 'value' => '', 'sort_order' => NULL, 'is_dependant' => FALSE, 'is_exclusive' => FALSE);
    $link_id = $child_asset->create($link);
    return $link_id;
}
开发者ID:joshgillies,项目名称:mysource-matrix,代码行数:16,代码来源:import_asset_csv_to_matrix.php

示例8: testDuplicateAssetPath

 /**
  * makes sure, that the creation of assets with duplicate paths is not possible
  * @expectedException Exception
  * @depends testAssetFolderCreate
  */
 public function testDuplicateAssetPath()
 {
     $key = uniqid();
     Asset::create(1, array("filename" => $key, "type" => "folder", "userOwner" => 1, "userModification" => 1));
     Asset::create(1, array("filename" => $key, "type" => "folder", "userOwner" => 1, "userModification" => 1));
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:11,代码来源:ElementCreateTest.php

示例9: createDirectory

 /**
  * creates a new folder in current directory
  *
  * @param string $name
  * @return string
  */
 function createDirectory($name)
 {
     $asset = Asset::create($this->asset->getId(), array("filename" => Pimcore_File::getValidFilename($name), "type" => "folder"));
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:10,代码来源:Folder.php


注:本文中的Asset::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。