Browse Source

remove more deprecated methods usage

Anthony GRASSIOT 9 years ago
parent
commit
cd537fa604

+ 2 - 2
src/Console/ConsoleIo.php

@@ -377,13 +377,13 @@ class ConsoleIo
                 '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]);
     }
 
     /**

+ 1 - 1
src/Controller/Component.php

@@ -51,7 +51,7 @@ use Cake\Log\LogTrait;
  *   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

+ 6 - 6
src/Controller/Component/AuthComponent.php

@@ -387,7 +387,7 @@ class AuthComponent extends Component
         }
 
         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 @@ class AuthComponent extends Component
             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 @@ class AuthComponent extends Component
      */
     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 @@ class AuthComponent extends Component
             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;

+ 10 - 10
src/Controller/Controller.php

@@ -500,12 +500,12 @@ class Controller implements EventListenerInterface, EventDispatcherInterface
     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 @@ class Controller implements EventListenerInterface, EventDispatcherInterface
     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 @@ class Controller implements EventListenerInterface, EventDispatcherInterface
         }
 
         $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 @@ class Controller implements EventListenerInterface, EventDispatcherInterface
         $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;

+ 1 - 1
src/Core/StaticConfigTrait.php

@@ -292,7 +292,7 @@ trait StaticConfigTrait
         $parsed = $queryArgs + $parsed;
 
         if (empty($parsed['className'])) {
-            $classMap = static::dsnClassMap();
+            $classMap = static::getDsnClassMap();
 
             $parsed['className'] = $parsed['scheme'];
             if (isset($classMap[$parsed['scheme']])) {

+ 3 - 3
src/Datasource/EntityTrait.php

@@ -242,11 +242,11 @@ trait EntityTrait
         $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 @@ trait EntityTrait
     {
         $result = [];
         foreach ($properties as $property) {
-            if (!$onlyDirty || $this->dirty($property)) {
+            if (!$onlyDirty || $this->isDirty($property)) {
                 $result[$property] = $this->get($property);
             }
         }

+ 2 - 2
src/Datasource/RulesAwareTrait.php

@@ -59,7 +59,7 @@ trait RulesAwareTrait
                 compact('entity', 'options', 'operation')
             );
             if ($event->isStopped()) {
-                return $event->result();
+                return $event->getResult();
             }
         }
 
@@ -72,7 +72,7 @@ trait RulesAwareTrait
             );
 
             if ($event->isStopped()) {
-                return $event->result();
+                return $event->getResult();
             }
         }
 

+ 2 - 2
src/Mailer/Email.php

@@ -339,7 +339,7 @@ class Email implements JsonSerializable, Serializable
             ->setHelpers(['Html']);
 
         if ($config === null) {
-            $config = static::config('default');
+            $config = static::getConfig('default');
         }
         if ($config) {
             $this->setProfile($config);
@@ -2102,7 +2102,7 @@ class Email implements JsonSerializable, Serializable
     {
         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));
             }

+ 1 - 1
src/ORM/Association/HasMany.php

@@ -264,7 +264,7 @@ class HasMany extends Association
 
         $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);
         });
 

+ 4 - 4
src/ORM/Behavior/CounterCacheBehavior.php

@@ -116,8 +116,8 @@ class CounterCacheBehavior extends Behavior
                     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 @@ class CounterCacheBehavior extends Behavior
                 $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;
             }

+ 1 - 1
src/ORM/Behavior/Translate/TranslateTrait.php

@@ -58,7 +58,7 @@ trait TranslateTrait
         }
 
         // Assume the user will modify any of the internal translations, helps with saving
-        $this->dirty('_translations', true);
+        $this->setDirty('_translations', true);
 
         return $i18n[$language];
     }

+ 1 - 1
src/ORM/Entity.php

@@ -56,7 +56,7 @@ class Entity implements EntityInterface, InvalidPropertyInterface
         ];
 
         if (!empty($options['source'])) {
-            $this->source($options['source']);
+            $this->setSource($options['source']);
         }
 
         if ($options['markNew'] !== null) {

+ 3 - 3
src/ORM/Marshaller.php

@@ -170,11 +170,11 @@ class Marshaller
         $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 @@ class Marshaller
             $entity->set($properties);
         }
 
-        $entity->errors($errors);
+        $entity->setErrors($errors);
 
         return $entity;
     }

+ 2 - 2
src/ORM/Table.php

@@ -1771,7 +1771,7 @@ class Table implements RepositoryInterface, EventListenerInterface, EventDispatc
         $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 @@ class Table implements RepositoryInterface, EventListenerInterface, EventDispatc
         ]);
 
         if ($event->isStopped()) {
-            return $event->result();
+            return $event->getResult();
         }
 
         $this->_associations->cascadeDelete(

+ 1 - 1
src/View/StringTemplate.php

@@ -29,7 +29,7 @@ class StringTemplate
 {
 
     use InstanceConfigTrait {
-        config as get;
+        getConfig as get;
     }
 
     /**

+ 2 - 2
src/View/View.php

@@ -971,8 +971,8 @@ class View implements EventDispatcherInterface
         $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])) {