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


PHP File::save方法代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     entity_create('field_storage_config', array('entity_type' => 'entity_test', 'field_name' => 'image_test', 'type' => 'image', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED))->save();
     entity_create('field_config', array('entity_type' => 'entity_test', 'field_name' => 'image_test', 'bundle' => 'entity_test'))->save();
     file_unmanaged_copy(DRUPAL_ROOT . '/core/misc/druplicon.png', 'public://example.jpg');
     $this->image = entity_create('file', array('uri' => 'public://example.jpg'));
     $this->image->save();
     $this->imageFactory = $this->container->get('image.factory');
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:10,代码来源:ImageThemeFunctionTest.php

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     FieldStorageConfig::create(array('entity_type' => 'entity_test', 'field_name' => 'image_test', 'type' => 'image', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED))->save();
     FieldConfig::create(['entity_type' => 'entity_test', 'field_name' => 'image_test', 'bundle' => 'entity_test'])->save();
     file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example.jpg');
     $this->image = File::create(['uri' => 'public://example.jpg']);
     $this->image->save();
     $this->imageFactory = $this->container->get('image.factory');
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:10,代码来源:ImageThemeFunctionTest.php

示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('file');
     $this->installSchema('file', array('file_usage'));
     entity_create('field_storage_config', array('field_name' => 'file_test', 'entity_type' => 'entity_test', 'type' => 'file', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED))->save();
     entity_create('field_config', array('entity_type' => 'entity_test', 'field_name' => 'file_test', 'bundle' => 'entity_test'))->save();
     file_put_contents('public://example.txt', $this->randomMachineName());
     $this->file = entity_create('file', array('uri' => 'public://example.txt'));
     $this->file->save();
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:11,代码来源:FileItemTest.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('file');
     $this->installSchema('file', array('file_usage'));
     FieldStorageConfig::create(array('field_name' => 'file_test', 'entity_type' => 'entity_test', 'type' => 'file', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED))->save();
     $this->directory = $this->getRandomGenerator()->name(8);
     FieldConfig::create(['entity_type' => 'entity_test', 'field_name' => 'file_test', 'bundle' => 'entity_test', 'settings' => array('file_directory' => $this->directory)])->save();
     file_put_contents('public://example.txt', $this->randomMachineName());
     $this->file = File::create(['uri' => 'public://example.txt']);
     $this->file->save();
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:12,代码来源:FileItemTest.php


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