1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-28 23:40:41 +02:00

Slim Framework integration #118 #117

- Fieldsets updates
This commit is contained in:
Awilum
2019-05-24 14:52:09 +03:00
parent bf94e6c842
commit 185341673d

View File

@@ -76,15 +76,15 @@ class Fieldsets
*
* @access public
* @param string $fieldset Fieldset
* @param string $data Data
* @param array $data Data
* @return bool True on success, false on failure.
*/
public function update(string $fieldset, string $data) : bool
public function update(string $fieldset, array $data) : bool
{
$fieldset_file = $this->_file_location($fieldset);
if (Filesystem::has($fieldset_file)) {
return Filesystem::write($fieldset_file, $data);
return Filesystem::write($fieldset_file, JsonParser::encode($data));
} else {
return false;
}
@@ -95,16 +95,16 @@ class Fieldsets
*
* @access public
* @param string $fieldset Fieldset
* @param string $data Data
* @param array $data Data
* @return bool True on success, false on failure.
*/
public function create(string $fieldset, string $data = '') : bool
public function create(string $fieldset, array $data) : bool
{
$fieldset_file = $this->_file_location($fieldset);
// Check if new entry file exists
if (!Filesystem::has($fieldset_file)) {
return Filesystem::write($fieldset_file, $data);
return Filesystem::write($fieldset_file, JsonParser::encode($data));
} else {
return false;
}