mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00: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(
|
||||
"Name" => "Varchar(255)",
|
||||
"Title" => "Varchar(255)",
|
||||
"File" =>"DBFile",
|
||||
"File" => "DBFile",
|
||||
// Only applies to files, doesn't inherit for folder
|
||||
'ShowInSearch' => 'Boolean(1)',
|
||||
);
|
||||
|
@ -1412,9 +1412,7 @@ class FormField extends RequestHandler {
|
||||
* @todo Add deep merging of arrays like `data` and `attributes`.
|
||||
*/
|
||||
public function setSchemaData($schemaData = []) {
|
||||
$current = $this->getSchemaData();
|
||||
|
||||
$this->schemaData = array_merge($current, array_intersect_key($schemaData, $current));
|
||||
$this->schemaData = array_merge($this->schemaData, $schemaData);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -1424,7 +1422,8 @@ class FormField extends RequestHandler {
|
||||
* @return array
|
||||
*/
|
||||
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`.
|
||||
*/
|
||||
public function setSchemaState($schemaState = []) {
|
||||
$current = $this->getSchemaState();
|
||||
|
||||
$this->schemaState = array_merge($current, array_intersect_key($schemaState, $current));
|
||||
$this->schemaState = array_merge($this->schemaState, array_intersect_key($schemaState, $this->schemaState));
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -1489,7 +1486,8 @@ class FormField extends RequestHandler {
|
||||
* @return array
|
||||
*/
|
||||
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()) {
|
||||
$fields->addFieldToTab('Root.Main', ReadonlyField::create('State', $this->fieldLabel('State')));
|
||||
}
|
||||
|
||||
$this->extend('updateCMSFields', $fields);
|
||||
return $fields;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user