\r
use Services\ICacheUpdater;\r
use Domain\Entities\StepMania\IPack;\r
+use DataAccess\StepMania\IPackRepository;\r
use Domain\Util;\r
\r
class CacheUpdater implements ICacheUpdater\r
{\r
private $_json;\r
+ private $_packRepository;\r
\r
- public function __construct() {\r
+ public function __construct(IPackRepository $packRepository) {\r
$this->_json = json_decode(file_get_contents('../SimfileCache/simfiles.json'), true);\r
+ $this->_packRepository = $packRepository;\r
}\r
\r
public function insert(IPack $pack)\r
{\r
+ //XXX: Tricky, when the pack comes in it may not be fully populated\r
+ //we are interested in keeping the cache in sync with the DB, so\r
+ //reload it from the DB to ensure we have everything.\r
+ $pack = $this->_packRepository->findById($pack->getId());\r
$this->_json['packs'][] = Util::packToArray($pack);\r
return $this;\r
}\r