Skip to content

Commit 41f0ed8

Browse files
committed
Adding verbose output back to the OrmCacheShell
1 parent 0da6794 commit 41f0ed8

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/ORM/OrmCache.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct($connection)
4949
* Build metadata.
5050
*
5151
* @param string|null $name The name of the table to build cache data for.
52-
* @return bool
52+
* @return array Returns a list build table caches
5353
*/
5454
public function build($name = null)
5555
{
@@ -62,14 +62,14 @@ public function build($name = null)
6262
$this->_schema->describe($table, ['forceRefresh' => true]);
6363
}
6464

65-
return true;
65+
return $tables;
6666
}
6767

6868
/**
6969
* Clear metadata.
7070
*
7171
* @param string|null $name The name of the table to clear cache data for.
72-
* @return bool
72+
* @return array Returns a list of cleared table caches
7373
*/
7474
public function clear($name = null)
7575
{
@@ -84,7 +84,7 @@ public function clear($name = null)
8484
Cache::delete($key, $configName);
8585
}
8686

87-
return true;
87+
return $tables;
8888
}
8989

9090
/**

src/Shell/OrmCacheShell.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ class OrmCacheShell extends Shell
4646
public function build($name = null)
4747
{
4848
$cache = $this->_getOrmCache();
49-
$cache->build($name);
49+
$tables = $cache->build($name);
50+
51+
foreach ($tables as $table) {
52+
$this->verbose(sprintf('Cached "%s"', $table));
53+
}
5054

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

@@ -62,7 +66,11 @@ public function build($name = null)
6266
public function clear($name = null)
6367
{
6468
$cache = $this->_getOrmCache();
65-
$cache->clear($name);
69+
$tables = $cache->clear($name);
70+
71+
foreach ($tables as $table) {
72+
$this->verbose(sprintf('Cleared "%s"', $table));
73+
}
6674

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

tests/TestCase/Shell/OrmCacheShellTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function setUp()
4747
$this->cache->expects($this->any())
4848
->method('init')
4949
->will($this->returnValue(true));
50-
Cache::getConfig('orm_cache', $this->cache);
50+
Cache::setConfig('orm_cache', $this->cache);
5151

5252
$ds = ConnectionManager::get('test');
5353
$ds->cacheMetadata('orm_cache');

0 commit comments

Comments
 (0)