Lookup a entity based on it's 'primary key' or key column
This will either return null or a Entity
@param mixed $key
@param bool $disableLateLoading
328466
public function find( $key, $disableLateLoading = null )
    {

        // $disableLateLoading default value management
        if( !is_bool( $disableLateLoading ) ) {
            $disableLateLoading = false;
        }

        // empty key
        if( is_null( $key ) or !is_scalar( $key ) or strlen( trim( $key ) ) === 0 ) {
            return null;
        }

        $class = $this->entityClass;

        try {
            return $this->entityFactory( $key, $disableLateLoading );
        } catch( \Exception $e ) {
            return null;
        }

    }
563924
public function getRelated($key)
    {

        if (isset($this->attributes[$key])) {
            return $this->attributes[$key];
        }

        if (!$this->isRelation($key)) {
            throw new RelationNotFoundException("Key $key is no relation");
        }

        if (!is_callable($this->lazyLoader)) {
            throw new UnConfiguredException('No callable assigned to load the relations.');
        }

        $this->attributes[$key] = call_user_func($this->lazyLoader, $this, $key);

        return $this->attributes[$key];

    }
431602
protected function _get($primaryKey)
    {
        $this->hydrateModel($primaryKey);

        return ($this->getModel() instanceof ActiveRecordInterface) ? $this->getModel() : NULL;
    }
620378
public function offsetUnset($key)
    {
        $this->items = array_filter($this->items, function ($item) use ($key) {
            $primaryKey = $this->getEntityKey($item);

            return $primaryKey !== $key;
        });
    }
669209
public function arrayAccessByKey($key)
    {
        if (! isset($this->nameLookupTable[$key])) {
            return null;
        }

        if (isset($this->items[$this->nameLookupTable[$key]])) {
            return $this->items[$this->nameLookupTable[$key]];
        }

        return null;
    }
1184537
public function def($key = null)
    {
        if ($key) return isset($this->definition[$key]) ? $this->definition[$key] : null;
        else return $this->definition;
    }
1288216
public function pull($key, $default = null)
    {
        $this->items = array_filter($this->items, function ($item) use ($key) {
            $primaryKey = $this->getEntityKey($item);

            return $primaryKey !== $key;
        });
    }
829030
protected function _isDisabled($key, $disabled)
    {
        if ($disabled === null) {
            return false;
        }
        $strict = !is_numeric($key);

        return in_array((string)$key, $disabled, $strict);
    }
43086
public function getSortableKey($key = null)
    {
        if ( ! is_null($key))
        {
            return $this->determineSortableKey($key);
        }

        return $this->getDefaultSortableKey();
    }
295436
public function getDataSource($key = 'database')
    {
        if ($this->container->exists('database')) {
            return $this->container->get($key);
        }

        return null;
    }
1115625
public function getLoaderDefinition($key)
    {
        if (array_key_exists($key, $this->loader)) {
            return $this->loader[$key];
        }

        return null;
    }
330843
private function defineRelation(callable $mapperLoader)
    {
        if (!$this->tableName || !$this->primaryKeyName || !$this->foreignKeyToParentName) {
            throw new InvalidOperationException(
                    'Must supply table name, primary key name and foreign key name for embedded collection relation'
            );
        }

        call_user_func($this->callback, $mapperLoader, $this->tableName, $this->primaryKeyName, $this->foreignKeyToParentName);
    }
600831
public function retrieve(string $key)
  {
    $file = $this->file;

    if (file_exists($file)) {
      $data = unserialize($this->decrypt(file_get_contents($file)));

      if (isset($data[$key])) {
        return $data[$key];
      }
    }

    return null;
  }
98142
public function offsetGet($key)
    {
        return isset($this->entities[$key]) ?
            $this->entities[$key] :
            null;
    }
68991
private function getQueryRootConverter(EntityMetadata $metadata, $key)
    {
        return function($value) use ($metadata, $key) {
            if ($key === Persister::POLYMORPHIC_KEY) {
                return $value;
            }
            $strategy = ($metadata->persistence instanceof StorageMetadata) ? $metadata->persistence->idStrategy : null;
            return $this->getIdentifierDbValue($value, $strategy);
        };
    }
1205327
protected function loadEntity($key)
    {
        $content = $this->getFileManager()->read($key);
        if($content) {
            return unserialize($content);
        }
        
        return null;
    }
545614
public function get($key)
    {
        $filename = $this->cacheDir . DIRECTORY_SEPARATOR . $this->processKey($key);

        if (is_file($filename) && is_readable($filename)) {
            if (@filemtime($filename) < (time() - $this->ttl)) {
                return null;
            } else {
                return unserialize($this->safelyReadData($filename));
            }
        }

        return null;
    }