source/Spiral/ORM/EntityMap.php
public function remember(RecordInterface $entity, bool $ignoreLimit = false): RecordInterface
    {
        if (!$ignoreLimit && !is_null($this->maxSize) && count($this->entities) > $this->maxSize - 1) {
            throw new MapException('Entity cache size exceeded');
        }

        if (empty($entity->primaryKey())) {
            throw new MapException("Unable to store non identified entity " . get_class($entity));
        }

        $cacheID = get_class($entity) . ':' . $entity->primaryKey();

        return $this->entities[$cacheID] = $entity;
    }
public function remember(RecordInterface $entity, bool $ignoreLimit = false): RecordInterface
    {
        if (!$ignoreLimit && !is_null($this->maxSize) && count($this->entities) > $this->maxSize - 1) {
            throw new MapException('Entity cache size exceeded');
        }

        if (empty($entity->primaryKey())) {
            throw new MapException("Unable to store non identified entity " . get_class($entity));
        }

        $cacheID = get_class($entity) . ':' . $entity->primaryKey();

        return $this->entities[$cacheID] = $entity;
    }
public function remember ( RecordInterface $ entity , bool $ ignoreLimit = false ) : RecordInterface { if ( ! $ ignoreLimit && ! is_null ( $ this -> maxSize ) && count ( $ this -> entities ) > $ this -> maxSize - 1 ) { throw new MapException ( 'Entity cache size exceeded' ) ; } if ( empty ( $ entity -> primaryKey ( ) ) ) { throw new MapException ( "Unable to store non identified entity " . get_class ( $ entity ) ) ; } $ cacheID = get_class ( $ entity ) . ':' . $ entity -> primaryKey ( ) ; return $ this -> entities [ $ cacheID ] = $ entity ; }
Add Record to entity cache. Primary key value will be used as
identifier.

Attention, existed entity will be replaced!

@param RecordInterface $entity
@param bool            $ignoreLimit Cache overflow will be ignored.

@return RecordInterface Returns given entity.

@throws MapException When cache size exceeded.
Add Record to entity cache . Primary key value will be used as identifier .