Code Duplication    Length = 8-13 lines in 3 locations

src/Relationships/Relationship.php 1 location

@@ 413-420 (lines=8) @@
410
     * @param  Mappable $entity
411
     * @return string
412
     */
413
    protected function getEntityHash(Mappable $entity)
414
    {
415
        $class = get_class($entity);
416
417
        $keyName = Mapper::getMapper($class)->getEntityMap()->getKeyName();
418
419
        return $class . '.' . $entity->getEntityAttribute($keyName);
420
    }
421
422
    /**
423
     * Run synchronization content if needed by the

src/System/EntityCache.php 1 location

@@ 226-235 (lines=10) @@
223
     * @throws MappingException
224
     * @return string
225
     */
226
    protected function getEntityHash(InternallyMappable $entity)
227
    {
228
        $class = get_class($entity->getObject());
229
230
        $mapper = Manager::getMapper($class);
231
232
        $keyName = $mapper->getEntityMap()->getKeyName();
233
234
        return $class . '.' . $entity->getEntityAttribute($keyName);
235
    }
236
237
    /**
238
     * Refresh the cache record for an aggregated entity after a write operation

src/EntityCollection.php 1 location

@@ 153-165 (lines=13) @@
150
     * @throws MappingException
151
     * @return string
152
     */
153
    public function getEntityHashes()
154
    {
155
        return array_map(function ($entity) {
156
            $class = get_class($entity);
157
158
            $mapper = Manager::getMapper($class);
159
160
            $keyName = $mapper->getEntityMap()->getKeyName();
161
162
            return $class . '.' . $entity->getEntityAttribute($keyName);
163
        },
164
        $this->items);
165
    }
166
167
    /**
168
     * Get a subset of the collection from entity hashes