diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a8b835..02f3b2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/composer.json b/composer.json index efa0dba..35c1883 100644 --- a/composer.json +++ b/composer.json @@ -22,12 +22,12 @@ } ], "require":{ - "cakephp/cakephp":"5.x-dev", - "friendsofcake/crud":"dev-cake-5" + "cakephp/cakephp":"^5.0", + "friendsofcake/crud":"^7.0" }, "require-dev":{ "phpunit/phpunit":"^10.1", - "friendsofcake/cakephp-test-utilities":"dev-cake-5.x" + "friendsofcake/cakephp-test-utilities":"^3.0" }, "autoload":{ "psr-4":{ @@ -44,7 +44,5 @@ "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true } - }, - "minimum-stability": "dev", - "prefer-stable": true + } } diff --git a/docs/_partials/actions/configuration/enabled.rst b/docs/_partials/actions/configuration/enabled.rst index 19833f1..3094f3e 100644 --- a/docs/_partials/actions/configuration/enabled.rst +++ b/docs/_partials/actions/configuration/enabled.rst @@ -4,7 +4,7 @@ enabled Test or modify if the Crud Action is enabled or not. When a CrudAction is disabled, Crud will not handle any requests to the action, and CakePHP will raise the normal -``\Cake\Error\MissingActionException`` exception if you haven't implemented the action in your controller. +``\Cake\Controller\Exception\MissingActionException`` exception if you haven't implemented the action in your controller. .. warning:: diff --git a/docs/_partials/events/after_find.rst b/docs/_partials/events/after_find.rst index d141c2f..7d52929 100644 --- a/docs/_partials/events/after_find.rst +++ b/docs/_partials/events/after_find.rst @@ -20,7 +20,7 @@ Logging the Found Item public function delete($id) { $this->Crud->on('afterFind', function(\Cake\Event\EventInterface $event) { - $this->log("Found item: " . $event->subject()->entity->id . " in the database"); + $this->log("Found item: " . $event->getSubject()->entity->id . " in the database"); }); return $this->Crud->execute(); diff --git a/docs/_partials/events/after_save.rst b/docs/_partials/events/after_save.rst index a5188b5..57499ed 100644 --- a/docs/_partials/events/after_save.rst +++ b/docs/_partials/events/after_save.rst @@ -22,7 +22,7 @@ Check Created Status public function edit($id) { $this->Crud->on('afterSave', function(\Cake\Event\EventInterface $event) { - if ($event->subject()->created) { + if ($event->getSubject()->created) { $this->log("The entity was created"); } else { $this->log("The entity was updated"); @@ -40,7 +40,7 @@ Check Success Status public function edit($id) { $this->Crud->on('afterSave', function(\Cake\Event\EventInterface $event) { - if ($event->subject()->success) { + if ($event->getSubject()->success) { $this->log("The entity was saved successfully"); } else { $this->log("The entity was NOT saved successfully"); @@ -58,8 +58,8 @@ Get Entity ID public function add() { $this->Crud->on('afterSave', function(\Cake\Event\EventInterface $event) { - if ($event->subject()->created) { - $this->log("The entity was created with id: " . $event->subject()->id); + if ($event->getSubject()->created) { + $this->log("The entity was created with id: " . $event->getSubject()->id); } }); diff --git a/docs/_partials/events/before_find.rst b/docs/_partials/events/before_find.rst index ff42531..f325deb 100644 --- a/docs/_partials/events/before_find.rst +++ b/docs/_partials/events/before_find.rst @@ -34,7 +34,7 @@ Add Conditions public function delete($id) { $this->Crud->on('beforeFind', function(\Cake\Event\EventInterface $event) { - $event->subject()->query->where(['author' => $this->Authentication->getIdentityData('id')]); + $event->getSubject()->query->where(['author' => $this->Authentication->getIdentityData('id')]); }); return $this->Crud->execute(); diff --git a/docs/_partials/events/set_flash.rst b/docs/_partials/events/set_flash.rst index 4bdda42..f9d25c8 100644 --- a/docs/_partials/events/set_flash.rst +++ b/docs/_partials/events/set_flash.rst @@ -48,8 +48,8 @@ If you'd like to configure it on the fly you can use the eventManager to change .. code-block:: phpinline $this->eventManager()->on('Crud.setFlash', function (\Cake\Event\EventInterface $event) { - if ($event->subject()->success) { - $event->subject()->params['class'] = 'alert alert-success alert-dismissible'; + if ($event->getSubject()->success) { + $event->getSubject()->params['class'] = 'alert alert-success alert-dismissible'; } }); diff --git a/docs/installation.rst b/docs/installation.rst index 527f3a3..cf0e142 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -3,12 +3,6 @@ Installation Installing CRUD Users requires only a few steps -Requirements ------------- - -* CakePHP 3.x -* PHP 5.6+ - Getting the Code ---------------- diff --git a/psalm.xml b/psalm.xml index ec91e46..44f7784 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,6 +1,6 @@ _controller()->Authentication->getResult(); $subject = $this->_subject([ 'success' => true, @@ -54,6 +55,7 @@ protected function _get(): ?Response */ protected function _post(): ?Response { + /** @psalm-suppress UndefinedMagicPropertyFetch */ $result = $this->_controller()->Authentication->getResult(); $subject = $this->_subject([ 'result' => $result, @@ -76,6 +78,7 @@ protected function _post(): ?Response */ protected function _success(Subject $subject): ?Response { + /** @psalm-suppress UndefinedMagicPropertyFetch */ $subject->set([ 'success' => true, 'identity' => $this->_controller()->Authentication->getIdentity(), diff --git a/src/Action/LogoutAction.php b/src/Action/LogoutAction.php index 07374e1..e723072 100644 --- a/src/Action/LogoutAction.php +++ b/src/Action/LogoutAction.php @@ -31,6 +31,7 @@ protected function _get(): ?Response $subject = $this->_subject(); $this->_trigger('beforeLogout', $subject); + /** @psalm-suppress UndefinedMagicPropertyFetch */ $redirectUrl = $this->_controller()->Authentication->logout(); $redirectUrl = $this->getConfig('redirectUrl', $redirectUrl); if ($redirectUrl === false) {