1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-08 06:06:45 +02:00

feat(entries): Entries API fetch improvements. #491

This commit is contained in:
Awilum
2020-12-11 14:55:59 +03:00
parent 1a8a82269d
commit 7e4c6c23ad

View File

@@ -150,18 +150,18 @@ class Entries
$cache = flextype('entries')->storage['fetch']['data']['cache']['enabled'] ??
flextype('registry')->get('flextype.settings.cache.enabled');
// Run event: onEntriesFetchSingleHasResult
flextype('emitter')->emit('onEntriesFetchSingleHasResult');
// Save entry data to cache
if ($cache) {
flextype('cache')->set($entryCacheID, $this->storage['fetch']['data']);
}
// Apply filter for fetch data
$this->storage['fetch']['data'] = filter($this->storage['fetch']['data'],
$this->storage['fetch']['options']);
// Run event: onEntriesFetchSingleHasResult
flextype('emitter')->emit('onEntriesFetchSingleHasResult');
// Save entry data to cache
if ($cache) {
flextype('cache')->set($entryCacheID, $this->storage['fetch']['data']);
}
// Return entry data
return arrays($this->storage['fetch']['data']);
}