Skip to content

Commit

Permalink
Bump to stable releases.
Browse files Browse the repository at this point in the history
Update docs
  • Loading branch information
ADmad committed Sep 28, 2023
1 parent 6c58455 commit 80c0193
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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":{
Expand All @@ -44,7 +44,5 @@
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
2 changes: 1 addition & 1 deletion docs/_partials/actions/configuration/enabled.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand Down
2 changes: 1 addition & 1 deletion docs/_partials/events/after_find.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions docs/_partials/events/after_save.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand All @@ -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);
}
});
Expand Down
2 changes: 1 addition & 1 deletion docs/_partials/events/before_find.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions docs/_partials/events/set_flash.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
});
Expand Down
6 changes: 0 additions & 6 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ Installation

Installing CRUD Users requires only a few steps

Requirements
------------

* CakePHP 3.x
* PHP 5.6+

Getting the Code
----------------

Expand Down
2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<psalm
errorLevel="5"
errorLevel="4"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
Expand Down
3 changes: 0 additions & 3 deletions src/Action/ForgotPasswordAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
use Crud\Traits\ViewTrait;
use Crud\Traits\ViewVarTrait;

/**
* @method \Cake\ORM\Table _model()
*/
class ForgotPasswordAction extends BaseAction
{
use FindMethodTrait;
Expand Down
3 changes: 3 additions & 0 deletions src/Action/LoginAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class LoginAction extends BaseAction
*/
protected function _get(): ?Response
{
/** @psalm-suppress UndefinedMagicPropertyFetch */
$result = $this->_controller()->Authentication->getResult();
$subject = $this->_subject([
'success' => true,
Expand All @@ -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,
Expand All @@ -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(),
Expand Down
1 change: 1 addition & 0 deletions src/Action/LogoutAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 80c0193

Please sign in to comment.