Skip to content

Commit 382907f

Browse files
authored
Remove _joinData property, if use belongsToMany (#100)
Remove _joinData property, if use belongsToMany Co-authored-by: Walther Lalk <[email protected]>
2 parents b1c04e2 + 5468661 commit 382907f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Listener/JsonApiListener.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Cake\Utility\Hash;
1616
use Cake\Utility\Inflector;
1717
use CrudJsonApi\Listener\JsonApi\DocumentValidator;
18-
use CrudJsonApi\Traits\JsonApiTrait;
1918
use Crud\Error\Exception\CrudException;
2019
use Crud\Event\Subject;
2120
use Crud\Listener\ApiListener;

src/Schema/JsonApi/DynamicEntitySchema.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ protected function getRepository($entity = null): Table
101101
*
102102
* This method will ignore any properties that are entities.
103103
*
104+
* @param \Cake\Datasource\EntityInterface $entity Entity
104105
* @return array
105106
*/
106107
protected function entityToShallowArray(EntityInterface $entity)
@@ -110,6 +111,10 @@ protected function entityToShallowArray(EntityInterface $entity)
110111
? $entity->getVisible()
111112
: $entity->visibleProperties();
112113
foreach ($properties as $property) {
114+
if ($property === '_joinData') {
115+
continue;
116+
}
117+
113118
$value = $entity->get($property);
114119
if (is_array($value)) {
115120
$result[$property] = [];

0 commit comments

Comments
 (0)