create() public method

DynamicField 생성 * ConfigManager 를 이용해 설정 정보를 저장 * FieldTypeManager 로 Dynamic Field Table 생성
public create ( ConfigEntity $config, ColumnEntity $column = null ) : void
$config Xpressengine\Config\ConfigEntity insert config entity
$column ColumnEntity join column entity
return void
Esempio n. 1
0
 /**
  * create default dynamic field
  *
  * @param ConfigEntity $boardConfig board config entity
  * @deprecated
  */
 protected function createDefaultDynamicField(ConfigEntity $boardConfig)
 {
     $category = Category::create(['name' => 'board-default']);
     $config = new ConfigEntity();
     foreach (['group' => $boardConfig->get('documentGroup'), 'revision' => $boardConfig->get('revision'), 'id' => 'category', 'typeId' => 'FieldType/xpressengine@Category', 'label' => 'board::category', 'skinId' => 'FieldType/xpressengine@Category/FieldSkin/xpressengine@default', 'use' => true, 'searchable' => true, 'required' => true, 'sortable' => false, 'tableMethod' => false, 'categoryId' => $category->id, 'colorSet' => 'default', 'joinColumnName' => 'id'] as $key => $value) {
         $config->set($key, $value);
     }
     $this->dynamicField->create($config);
 }
 /**
  * test create invalid config
  *
  * @expectedException \Xpressengine\DynamicField\Exceptions\AlreadyExistException
  * @return void
  */
 public function testCreateAlreadyExist()
 {
     $conn = $this->conn;
     $configHandler = $this->configHandler;
     $registerHandler = $this->registerHandler;
     $view = $this->view;
     $handler = new DynamicFieldHandler($conn, $configHandler, $registerHandler, $view);
     $config = $this->getConfigEntity();
     $config->shouldReceive('get')->with('id')->andReturn('id');
     $config->shouldReceive('get')->with('typeId')->andReturn('type');
     $config->shouldReceive('get')->with('group')->andReturn('group-name');
     $configHandler->shouldReceive('get')->andReturn(1);
     $handler->create($config);
 }