Look up which field is the ID

@param string $className
500118
private function findIdentityField(string $className): void
    {
        $this->metadata = $this->entityManager->getClassMetadata($className);
        foreach ($this->metadata->fieldMappings as $meta) {
            if ($meta['id'] ?? false) {
                $this->identityField = $meta['fieldName'];
            }
        }
    }
695864
private function getEntityByClass($className)
    {
        if (!isset($this->entities[ $className ])) {
            $entity                       = new Entity($this, $className);
            $this->entities[ $className ] = $entity;

            $this->metadataDriver->readEntityMetadata($entity);
        }

        return $this->entities[ $className ];
    }
592772
public static function delete_by_id($className, $id)
    {
        $obj = DataObject::get_by_id($className, $id);
        if ($obj) {
            $obj->delete();
        } else {
            user_error("$className object #$id wasn't found when calling DataObject::delete_by_id", E_USER_WARNING);
        }
    }
284414
public function getUrlByClassName($className)
    {
        if (is_object($className)) $className = get_class($className);
        if (isset($this->known[$className]['config']['mount'])) {
            return $this->known[$className]['config']['mount'];
        } else {
            return null;
        }
    }
1028321
public static function getEntityIdForClass($className)
    {
        self::entitiesMap();
        if (false === isset(self::$entitiesMap[$className])) {
            throw new InvalidParamException(Yii::t(
                'dotplant.entity.structure',
                'Unknown entity class \'{class}\'.',
                ['class' => $className]
            ));
        }
        return (int)self::$entitiesMap[$className]['id'];
    }
1361996
public function getFieldAlias($className, $field)
    {
        $apiMapping = $this->getApiMapping($className);
        $apiMapping = array_flip($apiMapping);
        return $this->getMappedKey($apiMapping, $field);
    }
1332140
function &findClass($className)
    {
        $return = NULL;
        if (isset($this->_classes[$className])) {
            $return =& $this->_classes[$className];
        }

        return $return;
    }
969143
public function hasClass($className)
    {
        if ($this->hasAttribute('class')) {
            return in_array($className, preg_split('/\s+/', $this->getAttribute('class')));
        }

        return false;
    }
666510
public function getSort($className='CSort')
	{
		if($this->_sort===null)
		{
			$this->_sort=new $className;
			if(($id=$this->getId())!='')
				$this->_sort->sortVar=$id.'_sort';
		}
		return $this->_sort;
	}
835766
public function getClassDefinition($className)
    {
        foreach ($this->definitions as $key => $value) {
            if (!strcasecmp($key, $className)) {
                return $value;
            }
        }

        return false;
    }
1137280
public function getClassAliasName($className)
    {
        /*
         * Sanitize input: class names in namespaces should not, but may include a leading backslash
         */
        $className = ltrim($className, '\\');
        $classAlias = array_search($className, $this->classMap);

        if ($classAlias === false) {
            $classAlias = null;
        }

        return $classAlias;
    }
1341405
public function classname($classname = null)
    {
        if ($classname === null) {
            return $this->classname;
        }

        $this->classname = $classname;
    }
623529
public function locateClass($className)
    {
        $filePath = $this->loader->findFile(ltrim($className, '\\'));
        if (!empty($filePath)) {
            $filePath = PathResolver::realpath($filePath);
        }

        return $filePath;
    }
835349
public function getContextObjectWithIDAndClass($id, $className) {
		$result = null;
		if ($id && $className) {
			$prevMode = Versioned::get_reading_mode();
			Versioned::set_reading_mode("Stage.Stage");

			$result = DataObject::get_by_id($className, $id);

			Versioned::set_reading_mode($prevMode);
		}
		return $result;
	}
1234532
private static function getInstance(string $className): string
    {
        $collector = EntityCollector::getCollector();
        if (!isset($collector[$className]['instance'])) {
            return Pool::INSTANCE;
        }

        return $collector[$className]['instance'];
    }
780975
private function getCachedDataByClassNameAndId($className, $id)
    {
        if (!array_key_exists($className, $this->cache)) {
            throw new CacheMissException();
        }

        if (!array_key_exists($id, $this->cache[$className])) {
            throw new CacheMissException();
        }

        return $this->cache[$className][$id];
    }
1204356
private function findTraced($className = null)
    {
        $traces     = debug_backtrace();
        $reflection = new ReflectionClass($className);
        $filename   = $reflection->getFileName();
        $traced     = null;


        foreach ($traces as $trace) {
            if (isset($trace['file']) and $filename == $trace['file']) {
                $traced = $trace;
                break;
            }
        }
        return $traced;
    }