protected function _deduplicateResultSet($subject)
    {
        $resultSet = clone $subject->entities;
        $ids = [];
        $keys = (array)$subject->query->getRepository()->getPrimaryKey();
        foreach ($subject->entities as $entity) {
            $id = $entity->extract($keys);
            if (!in_array($id, $ids)) {
                $entities[] = $entity;
                $ids[] = $id;
            }
        }

        if (isset($entities)) {
            $resultSet->unserialize(serialize($entities));
        }

        return $resultSet;
    }
protected function _deduplicateResultSet($subject)
    {
        $resultSet = clone $subject->entities;
        $ids = [];
        $keys = (array)$subject->query->getRepository()->getPrimaryKey();
        foreach ($subject->entities as $entity) {
            $id = $entity->extract($keys);
            if (!in_array($id, $ids)) {
                $entities[] = $entity;
                $ids[] = $id;
            }
        }

        if (isset($entities)) {
            $resultSet->unserialize(serialize($entities));
        }

        return $resultSet;
    }
protected function _deduplicateResultSet ( $ subject ) { $ resultSet = clone $ subject -> entities ; $ ids = [ ] ; $ keys = ( array ) $ subject -> query -> getRepository ( ) -> getPrimaryKey ( ) ; foreach ( $ subject -> entities as $ entity ) { $ id = $ entity -> extract ( $ keys ) ; if ( ! in_array ( $ id , $ ids ) ) { $ entities [ ] = $ entity ; $ ids [ ] = $ id ; } } if ( isset ( $ entities ) ) { $ resultSet -> unserialize ( serialize ( $ entities ) ) ; } return $ resultSet ; }
Deduplicate resultset from rows that might have come from joins

@param \Crud\Event\Subject $subject Subject
@return \Cake\ORM\ResultSet
Deduplicate resultset from rows that might have come from joins