Skip to content

Commit

Permalink
remove more deprecated methods usage
Browse files Browse the repository at this point in the history
  • Loading branch information
antograssiot committed Feb 4, 2017
1 parent c9d2695 commit cd537fa
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions src/Console/ConsoleIo.php
Expand Up @@ -377,13 +377,13 @@ public function setLoggers($enable)
'types' => $outLevels,
'stream' => $this->_out
]);
Log::config('stdout', ['engine' => $stdout]);
Log::setConfig('stdout', ['engine' => $stdout]);
}
$stderr = new ConsoleLog([
'types' => ['emergency', 'alert', 'critical', 'error', 'warning'],
'stream' => $this->_err,
]);
Log::config('stderr', ['engine' => $stderr]);
Log::setConfig('stderr', ['engine' => $stderr]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Component.php
Expand Up @@ -51,7 +51,7 @@
* propagation.
*
* While the controller is not an explicit argument for the callback methods it
* is the subject of each event and can be fetched using Event::subject().
* is the subject of each event and can be fetched using Event::getSubject().
*
* @link http://book.cakephp.org/3.0/en/controllers/components.html
* @see \Cake\Controller\Controller::$components
Expand Down
12 changes: 6 additions & 6 deletions src/Controller/Component/AuthComponent.php
Expand Up @@ -387,7 +387,7 @@ protected function _unauthenticated(Controller $controller)
}

if (!empty($this->_config['ajaxLogin'])) {
$controller->viewBuilder()->templatePath('Element');
$controller->viewBuilder()->setTemplatePath('Element');
$response = $controller->render(
$this->_config['ajaxLogin'],
$this->RequestHandler->ajaxLayout
Expand Down Expand Up @@ -745,8 +745,8 @@ protected function _getUser()
if (!empty($result) && is_array($result)) {
$this->_authenticationProvider = $auth;
$event = $this->dispatchEvent('Auth.afterIdentify', [$result, $auth]);
if ($event->result() !== null) {
$result = $event->result();
if ($event->getResult() !== null) {
$result = $event->getResult();
}
$this->storage()->write($result);

Expand Down Expand Up @@ -777,7 +777,7 @@ protected function _getUser()
*/
public function redirectUrl($url = null)
{
$redirectUrl = $this->request->query(static::QUERY_STRING_REDIRECT);
$redirectUrl = $this->request->getQuery(static::QUERY_STRING_REDIRECT);
if ($redirectUrl && (substr($redirectUrl, 0, 1) !== '/' || substr($redirectUrl, 0, 2) === '//')) {
$redirectUrl = null;
}
Expand Down Expand Up @@ -821,8 +821,8 @@ public function identify()
if (!empty($result)) {
$this->_authenticationProvider = $auth;
$event = $this->dispatchEvent('Auth.afterIdentify', [$result, $auth]);
if ($event->result() !== null) {
return $event->result();
if ($event->getResult() !== null) {
return $event->getResult();
}

return $result;
Expand Down
20 changes: 10 additions & 10 deletions src/Controller/Controller.php
Expand Up @@ -500,12 +500,12 @@ protected function _loadComponents()
public function startupProcess()
{
$event = $this->dispatchEvent('Controller.initialize');
if ($event->result() instanceof Response) {
return $event->result();
if ($event->getResult() instanceof Response) {
return $event->getResult();
}
$event = $this->dispatchEvent('Controller.startup');
if ($event->result() instanceof Response) {
return $event->result();
if ($event->getResult() instanceof Response) {
return $event->getResult();
}

return null;
Expand All @@ -523,8 +523,8 @@ public function startupProcess()
public function shutdownProcess()
{
$event = $this->dispatchEvent('Controller.shutdown');
if ($event->result() instanceof Response) {
return $event->result();
if ($event->getResult() instanceof Response) {
return $event->getResult();
}

return null;
Expand All @@ -549,8 +549,8 @@ public function redirect($url, $status = 302)
}

$event = $this->dispatchEvent('Controller.beforeRedirect', [$url, $response]);
if ($event->result() instanceof Response) {
return $this->response = $event->result();
if ($event->getResult() instanceof Response) {
return $this->response = $event->getResult();
}
if ($event->isStopped()) {
return null;
Expand Down Expand Up @@ -608,8 +608,8 @@ public function render($view = null, $layout = null)
$this->autoRender = false;

$event = $this->dispatchEvent('Controller.beforeRender');
if ($event->result() instanceof Response) {
return $event->result();
if ($event->getResult() instanceof Response) {
return $event->getResult();
}
if ($event->isStopped()) {
return $this->response;
Expand Down
2 changes: 1 addition & 1 deletion src/Core/StaticConfigTrait.php
Expand Up @@ -292,7 +292,7 @@ public static function parseDsn($dsn)
$parsed = $queryArgs + $parsed;

if (empty($parsed['className'])) {
$classMap = static::dsnClassMap();
$classMap = static::getDsnClassMap();

$parsed['className'] = $parsed['scheme'];
if (isset($classMap[$parsed['scheme']])) {
Expand Down
6 changes: 3 additions & 3 deletions src/Datasource/EntityTrait.php
Expand Up @@ -242,11 +242,11 @@ public function set($property, $value = null, array $options = [])
$options += ['setter' => true, 'guard' => $guard];

foreach ($property as $p => $value) {
if ($options['guard'] === true && !$this->accessible($p)) {
if ($options['guard'] === true && !$this->isAccessible($p)) {
continue;
}

$this->dirty($p, true);
$this->setDirty($p, true);

if (!array_key_exists($p, $this->_original) &&
array_key_exists($p, $this->_properties) &&
Expand Down Expand Up @@ -658,7 +658,7 @@ public function extract(array $properties, $onlyDirty = false)
{
$result = [];
foreach ($properties as $property) {
if (!$onlyDirty || $this->dirty($property)) {
if (!$onlyDirty || $this->isDirty($property)) {
$result[$property] = $this->get($property);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Datasource/RulesAwareTrait.php
Expand Up @@ -59,7 +59,7 @@ public function checkRules(EntityInterface $entity, $operation = RulesChecker::C
compact('entity', 'options', 'operation')
);
if ($event->isStopped()) {
return $event->result();
return $event->getResult();
}
}

Expand All @@ -72,7 +72,7 @@ public function checkRules(EntityInterface $entity, $operation = RulesChecker::C
);

if ($event->isStopped()) {
return $event->result();
return $event->getResult();
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Mailer/Email.php
Expand Up @@ -339,7 +339,7 @@ public function __construct($config = null)
->setHelpers(['Html']);

if ($config === null) {
$config = static::config('default');
$config = static::getConfig('default');
}
if ($config) {
$this->setProfile($config);
Expand Down Expand Up @@ -2102,7 +2102,7 @@ protected function _applyConfig($config)
{
if (is_string($config)) {
$name = $config;
$config = static::config($name);
$config = static::getConfig($name);
if (empty($config)) {
throw new InvalidArgumentException(sprintf('Unknown email configuration "%s".', $name));
}
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Association/HasMany.php
Expand Up @@ -264,7 +264,7 @@ public function link(EntityInterface $sourceEntity, array $targetEntities, array

$sourceEntity->set($property, $currentEntities);

$savedEntity = $this->connection()->transactional(function () use ($sourceEntity, $options) {
$savedEntity = $this->getConnection()->transactional(function () use ($sourceEntity, $options) {
return $this->saveAssociated($sourceEntity, $options);
});

Expand Down
8 changes: 4 additions & 4 deletions src/ORM/Behavior/CounterCacheBehavior.php
Expand Up @@ -116,8 +116,8 @@ public function beforeSave(Event $event, EntityInterface $entity)
continue;
}

$registryAlias = $assoc->target()->registryAlias();
$entityAlias = $assoc->property();
$registryAlias = $assoc->getTarget()->getRegistryAlias();
$entityAlias = $assoc->getProperty();

if (!is_callable($config) &&
isset($config['ignoreDirty']) &&
Expand Down Expand Up @@ -201,8 +201,8 @@ protected function _processAssociation(Event $event, EntityInterface $entity, As
$config = [];
}

if (isset($this->_ignoreDirty[$assoc->target()->registryAlias()][$field]) &&
$this->_ignoreDirty[$assoc->target()->registryAlias()][$field] === true
if (isset($this->_ignoreDirty[$assoc->getTarget()->getRegistryAlias()][$field]) &&
$this->_ignoreDirty[$assoc->getTarget()->getRegistryAlias()][$field] === true
) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Behavior/Translate/TranslateTrait.php
Expand Up @@ -58,7 +58,7 @@ public function translation($language)
}

// Assume the user will modify any of the internal translations, helps with saving
$this->dirty('_translations', true);
$this->setDirty('_translations', true);

return $i18n[$language];
}
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Entity.php
Expand Up @@ -56,7 +56,7 @@ public function __construct(array $properties = [], array $options = [])
];

if (!empty($options['source'])) {
$this->source($options['source']);
$this->setSource($options['source']);
}

if ($options['markNew'] !== null) {
Expand Down
6 changes: 3 additions & 3 deletions src/ORM/Marshaller.php
Expand Up @@ -170,11 +170,11 @@ public function one(array $data, array $options = [])
$entityClass = $this->_table->getEntityClass();
/* @var Entity $entity */
$entity = new $entityClass();
$entity->source($this->_table->getRegistryAlias());
$entity->setSource($this->_table->getRegistryAlias());

if (isset($options['accessibleFields'])) {
foreach ((array)$options['accessibleFields'] as $key => $value) {
$entity->accessible($key, $value);
$entity->setAccess($key, $value);
}
}
$errors = $this->_validate($data, $options, true);
Expand Down Expand Up @@ -210,7 +210,7 @@ public function one(array $data, array $options = [])
$entity->set($properties);
}

$entity->errors($errors);
$entity->setErrors($errors);

return $entity;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ORM/Table.php
Expand Up @@ -1771,7 +1771,7 @@ protected function _processSave($entity, $options)
$event = $this->dispatchEvent('Model.beforeSave', compact('entity', 'options'));

if ($event->isStopped()) {
return $event->result();
return $event->getResult();
}

$saved = $this->_associations->saveParents(
Expand Down Expand Up @@ -2099,7 +2099,7 @@ protected function _processDelete($entity, $options)
]);

if ($event->isStopped()) {
return $event->result();
return $event->getResult();
}

$this->_associations->cascadeDelete(
Expand Down
2 changes: 1 addition & 1 deletion src/View/StringTemplate.php
Expand Up @@ -29,7 +29,7 @@ class StringTemplate
{

use InstanceConfigTrait {
config as get;
getConfig as get;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/View/View.php
Expand Up @@ -971,8 +971,8 @@ protected function _render($viewFile, $data = [])
$content = $this->_evaluate($viewFile, $data);

$afterEvent = $this->dispatchEvent('View.afterRenderFile', [$viewFile, $content]);
if ($afterEvent->result() !== null) {
$content = $afterEvent->result();
if ($afterEvent->getResult() !== null) {
$content = $afterEvent->getResult();
}

if (isset($this->_parents[$viewFile])) {
Expand Down

0 comments on commit cd537fa

Please sign in to comment.