Skip to content

Commit 70a8d7e

Browse files
authored
Replace use of deprecated method with non-deprecated method (#102)
Replace use of deprecated method with non-deprecated method
2 parents 508a855 + a300214 commit 70a8d7e

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ parameters:
55
- Crud\Event\Subject
66
ignoreErrors:
77
# ORM
8+
- '#Call to an undefined method Cake\\Datasource\\EntityInterface::getVisible().#'
89

910
# Crud properties
1011
- '#Access to an undefined property object::\$created#'

src/Listener/JsonApiListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
use Cake\Event\Event;
99
use Cake\Http\Exception\BadRequestException;
1010
use Cake\ORM\Association;
11+
use Cake\ORM\Query;
1112
use Cake\ORM\ResultSet;
1213
use Cake\ORM\Table;
1314
use Cake\ORM\TableRegistry;
14-
use Cake\ORM\Query;
1515
use Cake\Utility\Hash;
1616
use Cake\Utility\Inflector;
1717
use CrudJsonApi\Listener\JsonApi\DocumentValidator;

src/Schema/JsonApi/DynamicEntitySchema.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ protected function getRepository($entity = null): Table
106106
protected function entityToShallowArray(EntityInterface $entity)
107107
{
108108
$result = [];
109-
foreach ($entity->visibleProperties() as $property) {
109+
$properties = method_exists($entity, 'getVisible')
110+
? $entity->getVisible()
111+
: $entity->visibleProperties();
112+
foreach ($properties as $property) {
110113
$value = $entity->get($property);
111114
if (is_array($value)) {
112115
$result[$property] = [];

0 commit comments

Comments
 (0)