Skip to content
Permalink
Browse files

remove more deprecated methods usage

  • Loading branch information...
antograssiot committed Feb 4, 2017
1 parent c9d2695 commit cd537fa60402ace4ea03d33355138699aea1ae77
@@ -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]);
}
/**
@@ -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
@@ -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
@@ -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);
@@ -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;
}
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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']])) {
@@ -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) &&
@@ -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);
}
}
@@ -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();
}
}
@@ -72,7 +72,7 @@ public function checkRules(EntityInterface $entity, $operation = RulesChecker::C
);
if ($event->isStopped()) {
return $event->result();
return $event->getResult();
}
}
@@ -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);
@@ -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));
}
@@ -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);
});
@@ -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']) &&
@@ -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;
}
@@ -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];
}
@@ -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) {
@@ -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);
@@ -210,7 +210,7 @@ public function one(array $data, array $options = [])
$entity->set($properties);
}
$entity->errors($errors);
$entity->setErrors($errors);
return $entity;
}
@@ -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(
@@ -2099,7 +2099,7 @@ protected function _processDelete($entity, $options)
]);
if ($event->isStopped()) {
return $event->result();
return $event->getResult();
}
$this->_associations->cascadeDelete(
@@ -29,7 +29,7 @@ class StringTemplate
{
use InstanceConfigTrait {
config as get;
getConfig as get;
}
/**
@@ -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])) {

0 comments on commit cd537fa

Please sign in to comment.
You can’t perform that action at this time.