Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CakePHP4.5に対応 #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Model/Table/SoftDeleteTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
use Cake\ORM\RulesChecker;
use Cake\Datasource\EntityInterface;
use SoftDelete\Error\MissingColumnException;
use SoftDelete\ORM\Query;
use SoftDelete\ORM\SelectQuery;

trait SoftDeleteTrait
{
/**
* Get the configured deletion field
*
* @return string
* @throws \SoftDelete\Error\MissingFieldException
* @throws \SoftDelete\Error\MissingColumnException
*/
public function getSoftDeleteField()
{
Expand Down Expand Up @@ -41,11 +41,11 @@ public function getSoftDeleteField()
* Fatal error: Declaration of SoftDelete\Model\Table\SoftDeleteTrait::query(): SoftDelete\ORM\Query must be compatible with Cake\ORM\Table::query(): Cake\ORM\Query
* 上記エラー回避のため戻り値の型宣言では実体と異なるがCakePHP本体のquery()で定義されている上書き元の型(\Cake\ORM\Query)を明示する
*
* @return \SoftDelete\ORM\Query
* @return \SoftDelete\ORM\SelectQuery
*/
public function query(): \Cake\ORM\Query
public function SelectQuery(): SelectQuery
{
return new Query($this->getConnection(), $this);
return new SelectQuery($this->getConnection(), $this);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/ORM/Query.php → src/ORM/SelectQuery.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
namespace SoftDelete\ORM;

use Cake\ORM\Query as CakeQuery;
use Cake\ORM\Query\SelectQuery as CakeQuery;

/**
* Soft delete-aware query
*/
class Query extends CakeQuery
class SelectQuery extends CakeQuery
{
/**
* Overwriting triggerBeforeFind() to let queries not return soft deleted records
Expand Down