Skip to content

Commit

Permalink
Adding verbose output back to the OrmCacheShell
Browse files Browse the repository at this point in the history
  • Loading branch information
burzum committed Aug 1, 2017
1 parent 0da6794 commit 41f0ed8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/ORM/OrmCache.php
Expand Up @@ -49,7 +49,7 @@ public function __construct($connection)
* Build metadata.
*
* @param string|null $name The name of the table to build cache data for.
* @return bool
* @return array Returns a list build table caches
*/
public function build($name = null)
{
Expand All @@ -62,14 +62,14 @@ public function build($name = null)
$this->_schema->describe($table, ['forceRefresh' => true]);
}

return true;
return $tables;
}

/**
* Clear metadata.
*
* @param string|null $name The name of the table to clear cache data for.
* @return bool
* @return array Returns a list of cleared table caches
*/
public function clear($name = null)
{
Expand All @@ -84,7 +84,7 @@ public function clear($name = null)
Cache::delete($key, $configName);
}

return true;
return $tables;
}

/**
Expand Down
12 changes: 10 additions & 2 deletions src/Shell/OrmCacheShell.php
Expand Up @@ -46,7 +46,11 @@ class OrmCacheShell extends Shell
public function build($name = null)
{
$cache = $this->_getOrmCache();
$cache->build($name);
$tables = $cache->build($name);

foreach ($tables as $table) {
$this->verbose(sprintf('Cached "%s"', $table));
}

$this->out('<success>Cache build complete</success>');

Expand All @@ -62,7 +66,11 @@ public function build($name = null)
public function clear($name = null)
{
$cache = $this->_getOrmCache();
$cache->clear($name);
$tables = $cache->clear($name);

foreach ($tables as $table) {
$this->verbose(sprintf('Cleared "%s"', $table));
}

$this->out('<success>Cache clear complete</success>');

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Shell/OrmCacheShellTest.php
Expand Up @@ -47,7 +47,7 @@ public function setUp()
$this->cache->expects($this->any())
->method('init')
->will($this->returnValue(true));
Cache::getConfig('orm_cache', $this->cache);
Cache::setConfig('orm_cache', $this->cache);

$ds = ConnectionManager::get('test');
$ds->cacheMetadata('orm_cache');
Expand Down

0 comments on commit 41f0ed8

Please sign in to comment.