1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-20 11:51:28 +02:00

feat(core): update Entries methods #212 #186

- update method read: return file_parser name
- update method update: ability to save with different parser types
This commit is contained in:
Awilum
2019-08-20 10:50:38 +03:00
parent fbae0adbf2
commit ed64b71687

View File

@@ -391,10 +391,8 @@ class Entries
*/
public function update(string $id, array $data) : bool
{
$entry_file = $this->_file_location($id);
if (Filesystem::has($entry_file)) {
return Filesystem::write($entry_file, JsonParser::encode($data));
if ($_entry = $this->read($id)) {
return Filesystem::write($_entry['file_path'], Parser::encode($data, $_entry['file_parser']));
}
return false;
@@ -502,6 +500,7 @@ class Entries
return [
'file_path' => $file_path,
'file_data' => $file_data,
'file_parser' => $parser['name']
];
}
}