protected function getAllRecords($dataDimensions = null) { if ($dataDimensions == null) { $dataDimensions = $this->getCurrentDataDimensions(); } if ($this->isAllContentRecordsCaching()) { $cacheKey = $this->createCacheKey('records-query', [$this->getCurrentContentTypeName(), '', 1, null, '.id'], $dataDimensions); $data = $this->getCacheProvider()->fetch($cacheKey); if ($data) { $data = json_decode($data, true); $recordFactory = $this->getRecordFactory(); $records = $recordFactory->createRecordsFromJSONRecordsArray($this->getCurrentContentTypeDefinition(), $data); foreach ($records as $record) { $record->setRepository($this); } return $records; } $records = parent::getAllRecords($dataDimensions); $data = json_encode($records); $this->getCacheProvider()->save($cacheKey, $data, $this->allContentRecordsCaching); return $records; } return parent::getAllRecords($dataDimensions); }
protected function getAllRecords() { if ($this->isAllContentRecordsCaching()) { $cacheKey = $this->createCacheKey('allrecords', [$this->getCurrentContentTypeName()]); $data = $this->getCacheProvider()->fetch($cacheKey); if ($data) { $data = json_decode($data, true); $recordFactory = new RecordFactory(['validateProperties' => false]); $records = $recordFactory->createRecordsFromJSONRecordsArray($this->getCurrentContentTypeDefinition(), $data); return $records; } $records = parent::getAllRecords(); $data = json_encode($records); $this->getCacheProvider()->save($cacheKey, $data, $this->allContentRecordsCaching); return $records; } return parent::getAllRecords(); }