mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Fix php schema generation
This commit is contained in:
parent
67f00302f9
commit
0901de2995
@ -114,7 +114,7 @@ class File extends DataObject implements ShortcodeHandler, AssetContainer, Thumb
|
|||||||
private static $db = array(
|
private static $db = array(
|
||||||
"Name" => "Varchar(255)",
|
"Name" => "Varchar(255)",
|
||||||
"Title" => "Varchar(255)",
|
"Title" => "Varchar(255)",
|
||||||
"File" =>"DBFile",
|
"File" => "DBFile",
|
||||||
// Only applies to files, doesn't inherit for folder
|
// Only applies to files, doesn't inherit for folder
|
||||||
'ShowInSearch' => 'Boolean(1)',
|
'ShowInSearch' => 'Boolean(1)',
|
||||||
);
|
);
|
||||||
|
@ -1412,9 +1412,7 @@ class FormField extends RequestHandler {
|
|||||||
* @todo Add deep merging of arrays like `data` and `attributes`.
|
* @todo Add deep merging of arrays like `data` and `attributes`.
|
||||||
*/
|
*/
|
||||||
public function setSchemaData($schemaData = []) {
|
public function setSchemaData($schemaData = []) {
|
||||||
$current = $this->getSchemaData();
|
$this->schemaData = array_merge($this->schemaData, $schemaData);
|
||||||
|
|
||||||
$this->schemaData = array_merge($current, array_intersect_key($schemaData, $current));
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1424,7 +1422,8 @@ class FormField extends RequestHandler {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getSchemaData() {
|
public function getSchemaData() {
|
||||||
return array_replace_recursive($this->getSchemaDataDefaults(), $this->schemaData);
|
$defaults = $this->getSchemaDataDefaults();
|
||||||
|
return array_replace_recursive($defaults, array_intersect_key($this->schemaData, $defaults));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1477,9 +1476,7 @@ class FormField extends RequestHandler {
|
|||||||
* @todo Add deep merging of arrays like `data` and `attributes`.
|
* @todo Add deep merging of arrays like `data` and `attributes`.
|
||||||
*/
|
*/
|
||||||
public function setSchemaState($schemaState = []) {
|
public function setSchemaState($schemaState = []) {
|
||||||
$current = $this->getSchemaState();
|
$this->schemaState = array_merge($this->schemaState, array_intersect_key($schemaState, $this->schemaState));
|
||||||
|
|
||||||
$this->schemaState = array_merge($current, array_intersect_key($schemaState, $current));
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1489,7 +1486,8 @@ class FormField extends RequestHandler {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getSchemaState() {
|
public function getSchemaState() {
|
||||||
return array_merge($this->getSchemaStateDefaults(), $this->schemaState);
|
$defaults = $this->getSchemaStateDefaults();
|
||||||
|
return array_merge($defaults, array_intersect_key($this->schemaState, $defaults));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -399,6 +399,7 @@ class ChangeSet extends DataObject {
|
|||||||
if ($this->isInDB()) {
|
if ($this->isInDB()) {
|
||||||
$fields->addFieldToTab('Root.Main', ReadonlyField::create('State', $this->fieldLabel('State')));
|
$fields->addFieldToTab('Root.Main', ReadonlyField::create('State', $this->fieldLabel('State')));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->extend('updateCMSFields', $fields);
|
$this->extend('updateCMSFields', $fields);
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user