Skip to content

Commit

Permalink
Remove _joinData property, if use belongsToMany (#100)
Browse files Browse the repository at this point in the history
Remove _joinData property, if use belongsToMany

Co-authored-by: Walther Lalk <83255+dakota@users.noreply.github.com>
  • Loading branch information
dakota committed Jul 10, 2019
2 parents b1c04e2 + 5468661 commit 382907f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/Listener/JsonApiListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Cake\Utility\Hash;
use Cake\Utility\Inflector;
use CrudJsonApi\Listener\JsonApi\DocumentValidator;
use CrudJsonApi\Traits\JsonApiTrait;
use Crud\Error\Exception\CrudException;
use Crud\Event\Subject;
use Crud\Listener\ApiListener;
Expand Down
5 changes: 5 additions & 0 deletions src/Schema/JsonApi/DynamicEntitySchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ protected function getRepository($entity = null): Table
*
* This method will ignore any properties that are entities.
*
* @param \Cake\Datasource\EntityInterface $entity Entity
* @return array
*/
protected function entityToShallowArray(EntityInterface $entity)
Expand All @@ -110,6 +111,10 @@ protected function entityToShallowArray(EntityInterface $entity)
? $entity->getVisible()
: $entity->visibleProperties();
foreach ($properties as $property) {
if ($property === '_joinData') {
continue;
}

$value = $entity->get($property);
if (is_array($value)) {
$result[$property] = [];
Expand Down

0 comments on commit 382907f

Please sign in to comment.