Skip to content

Commit

Permalink
Remove deprecations.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Apr 28, 2018
1 parent 1e408a9 commit 19e49e2
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions config/database_log.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
],
'monitorCallback' => function (\Cake\Event\Event $event) {
/** @var \DatabaseLog\Model\Table\DatabaseLogsTable $logsTable */
$logsTable = $event->subject();
$logsTable = $event->getSubject();

/* @var \DatabaseLog\Model\Entity\DatabaseLog[] $logs */
$logs = $event->data('logs');
$logs = $event->getData('logs');

$content = '';
foreach ($logs as $log) {
$content .= $logsTable->format($log);
}

$mailer = new \Cake\Mailer\Mailer();
$email = new \Cake\Mailer\Email();
$subject = count($logs) . ' new error log entries';
// TODO Implement
}
Expand Down
5 changes: 3 additions & 2 deletions config/routes.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php
use Cake\Routing\Router;
use Cake\Routing\Route\DashedRoute;
use Cake\Routing\RouteBuilder;

Router::prefix('admin', function ($routes) {
$routes->plugin('DatabaseLog', ['path' => '/database-log'], function ($routes) {
Router::prefix('admin', function (RouteBuilder $routes) {
$routes->plugin('DatabaseLog', ['path' => '/database-log'], function (RouteBuilder $routes) {
$routes->fallbacks(DashedRoute::class);
});
});
5 changes: 2 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@
<!-- Setup a listener for fixtures -->
<listeners>
<listener
class="\Cake\TestSuite\Fixture\FixtureInjector"
file="vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php">
class="\Cake\TestSuite\Fixture\FixtureInjector">
<arguments>
<object class="\Cake\TestSuite\Fixture\FixtureManager" />
<object class="\Cake\TestSuite\Fixture\FixtureManager"/>
</arguments>
</listener>
</listeners>
Expand Down
8 changes: 4 additions & 4 deletions src/Model/Table/DatabaseLogsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ class DatabaseLogsTable extends DatabaseLogAppTable {
* @return void
*/
public function initialize(array $config) {
$this->displayField('type');
$this->setDisplayField('type');
$this->addBehavior('Timestamp', ['modified' => false]);
$this->ensureTables(['DatabaseLog.DatabaseLogs']);

$callback = Configure::read('DatabaseLog.monitorCallback');
if (!$callback) {
return;
}
$this->eventManager()->on('DatabaseLog.alert', $callback);
$this->getEventManager()->on('DatabaseLog.alert', $callback);
}

/**
Expand Down Expand Up @@ -200,7 +200,7 @@ protected function _cleanByAge() {
* @return void
*/
public function truncate() {
$sql = $this->schema()->truncateSql($this->_connection);
$sql = $this->getSchema()->truncateSql($this->_connection);
foreach ($sql as $snippet) {
$this->_connection->execute($snippet);
}
Expand All @@ -212,7 +212,7 @@ public function truncate() {
*/
public function notify(ResultSetInterface $logs) {
$event = new Event('DatabaseLog.alert', $this, ['logs' => $logs]);
$this->eventManager()->dispatch($event);
$this->getEventManager()->dispatch($event);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Table/LazyTableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function ensureTables(array $fixtures) {
if ($class === false) {
throw new RuntimeException("Unknown fixture '$name'.");
}
$fixture = new $class($this->connection()->configName());
$fixture = new $class($this->getConnection()->configName());
$table = $fixture->table;
if (in_array($table, $existing)) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/View/Helper/LogHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testTypeLabel() {
* @return void
*/
public function testTypeLabelDisabled() {
$this->Log->config('typeMap', false);
$this->Log->setConfig('typeMap', false);

$result = $this->Log->typeLabel('<Sweet>');
$expected = '&lt;Sweet&gt;';
Expand Down

0 comments on commit 19e49e2

Please sign in to comment.