Return base entityKey in case of sub entity (for instance: returns car in car:hybrid)

@param string $entityKey
@return string
2495
protected function getBaseEntityKey(string $entityKey): string
    {
        if(($pos = strpos($entityKey, ':')) !== false) {
            return substr($entityKey, 0, $pos);
        }

        return $entityKey;
    }
717547
public function isLast($key)
    {
        if (null === $this->lastKey) {
            end($this->hierarchy);
            $this->lastKey = key($this->hierarchy);
        }

        return $key === $this->lastKey;
    }
717871
public function get($key) {
        if (array_key_exists($key, $this->_fields)) {
            if (gettype($this->_fields['' . $key . '']) == 'object') {
                return $this->_fields['' . $key . '']->value;
            }
            else {
                return $this->_fields['' . $key . ''];
            }
        }
        else {
            throw new MissingEntityException('The field "' . $key . '" doesn\'t exist in ' . $this->_name);
        }
    }
43086
public function getSortableKey($key = null)
    {
        if ( ! is_null($key))
        {
            return $this->determineSortableKey($key);
        }

        return $this->getDefaultSortableKey();
    }
90402
protected function getNormalizedKey($key): string
    {
        // Keys within collections must be offset based
        if (!\is_int($key) && $this->isCollection() && !preg_match('/^\d+\./', $key)) {
            $key = "0.$key";
        }

        return $key;
    }
1296308
protected static function _getConfigByKey($key) {
		$dbConfig = self::_getEngine()->get($key);
		$fileConfig = Configure::read($key);
		if (!is_null($fileConfig)) {
			$dbConfig = Hash::mergeDiff((array)$dbConfig, $fileConfig);
		}

		return $dbConfig;
	}
46296
protected function getOneByCompoundKey($key)
	{
		$sanitizedKey = [];

		// We can can potentially accept an associaitve or standard array.
		if($this->isAssociativeArray($key))
		{
			if(array_key_exists('entity_type', $key) &&  array_key_exists('entity_id', $key))
			{
				$sanitizedKey['entity_type'] = $key['entity_type'];
				$sanitizedKey['entity_id']   = $key['entity_id'];
			}
			else
			{
				return new Payload(null, 'insufficient_entity_key');
			}
		}
		else
		{
			$sanitizedKey['entity_type'] = $key[0];
			$sanitizedKey['entity_id']   = $key[1];
		}

		return $this->aggregate[$this->formatEntityType($sanitizedKey['entity_type'])]->get([['field' => 'id', 'value' => $sanitizedKey['entity_id'], 'operator' => '=', 'or' => false]]);
	}
1205326
protected function getIdCompanyByKey(string $companyKey): int
    {
        if (!isset($this->idCompanyListCache[$companyKey])) {
            $idCompany = $this->getCompanyQuery()
                ->filterByKey($companyKey)
                ->select(SpyCompanyTableMap::COL_ID_COMPANY)
                ->findOne();

            if (!$idCompany) {
                throw new EntityNotFoundException(sprintf('Could not find company by key "%s"', $companyKey));
            }

            $this->idCompanyListCache[$companyKey] = $idCompany;
        }

        return $this->idCompanyListCache[$companyKey];
    }
73674
protected function localKey($key)
    {
        if (empty($this->schema[$key])) {
            return null;
        }

        return $this->getAlias() . '.' . $this->schema[$key];
    }
485693
public function get($key)
    {
        $this->initialize();

        $ids = explode('.', $key);
        $base = &$this->data;

        while ($current = array_shift($ids)) {
            if (is_array($base) && array_key_exists($current, $base)) {
                $base = &$base[$current];
            } else {
                return null;
            }
        }

        return $base;
    }
820741
public function selectOneEntity (int $key)
    {
        try {
            $this->_prepare['selectOneEntity']->bindParam(1, $key, \PDO::PARAM_INT);
            $this->_prepare['selectOneEntity']->execute();
            
            $r = $this->_prepare['selectOneEntity']->fetchAll(\PDO::FETCH_NUM);
            $this->_prepare['selectOneEntity']->closeCursor();
            if (!empty($r)) :
                return $this->_dataContextObject->dataCallBack( $r[0][1] );
            else :
                return false;
            endif;
        } catch (\Exception $e) {
            throw $e;
        }
    }
237919
protected function getClassKey($entity)
    {
        $parts = explode('.', $entity);
        $class = array_shift($parts);

        // Ensure the `.ss` suffix gets added to the top level class rather than the key
        if (count($parts) > 1 && reset($parts) === 'ss') {
            $class .= '.ss';
            array_shift($parts);
        }
        $key = implode('.', $parts);
        return array($class, $key);
    }
1332296
public function primaryKey($key = null)
    {
        deprecationWarning(
            get_called_class() . '::primaryKey() is deprecated. ' .
            'Use setPrimaryKey()/getPrimaryKey() instead.'
        );
        if ($key !== null) {
            $this->setPrimaryKey($key);
        }

        return $this->getPrimaryKey();
    }
525833
protected function splitKey(string $key)
    {
        if (!$this->multilevel) {
            return $key;
        }

        $slug_array = explode($this->separator, $key);

        if (count($slug_array) == 1) {
            return $key;
        }

        return $slug_array;
    }
91708
public function getIdCompanyBusinessUnitByKey(string $companyBusinessUnitKey): int
    {
        if (isset($this->idCompanyBusinessUnitListCache[$companyBusinessUnitKey])) {
            return $this->idCompanyBusinessUnitListCache[$companyBusinessUnitKey];
        }

        $idCompanyBusinessUnit = $this->getFactory()->createCompanyBusinessUnitQuery()
            ->filterByKey($companyBusinessUnitKey)
            ->select(SpyCompanyBusinessUnitTableMap::COL_ID_COMPANY_BUSINESS_UNIT)
            ->findOne();

        if (!$idCompanyBusinessUnit) {
            throw new EntityNotFoundException(sprintf('Could not find company business unit by key "%s"', $companyBusinessUnitKey));
        }

        $this->idCompanyBusinessUnitListCache[$companyBusinessUnitKey] = $idCompanyBusinessUnit;

        return $this->idCompanyBusinessUnitListCache[$companyBusinessUnitKey];
    }
970467
protected function determineSortableKey($key)
    {
        // We need to allow source attributes here
        if (in_array($key, $this->sortableColumns) || $this->isTranslationAttribute($key))
        {
            return $key;
        }

        return $this->getDefaultSortableKey();
    }
1205327
protected function loadEntity($key)
    {
        $content = $this->getFileManager()->read($key);
        if($content) {
            return unserialize($content);
        }
        
        return null;
    }