Fetch a class schema for the given class, if possible.

@param string $className
@return ClassSchema
@throws ClassSchemaNotFoundException
425391
protected function getClassSchema($className)
    {
        $classSchema = $this->reflectionService->getClassSchema($className);
        if (!$classSchema) {
            throw new ClassSchemaNotFoundException('No class schema found for "' . $className . '".', 1295973082);
        }

        return $classSchema;
    }
1129912
protected function fetchSchemaOid()
    {
        $schema_oid = $this
            ->getSession()
            ->getInspector()
            ->getSchemaOid($this->schema)
            ;

        if ($schema_oid === null) {
            throw new CliException(
                sprintf(
                    "Could not find schema '%s'.",
                    $this->schema
                )
            );
        }

        return $schema_oid;
    }
6979
public function buildFromClass($classname)
	{
		$reflectionClass = new ReflectionClass($classname);

		$classDefinition = new ClassDefinition();
		$classDefinition->name = $reflectionClass->getName();
		$classDefinition->namespace = $reflectionClass->getNamespaceName();

		$reflectionProperties = $this->classPropertyFinder->findProperties($reflectionClass);

		foreach ($reflectionProperties as $reflectionProperty) {
			$classDefinition->properties[$reflectionProperty->getName()] = $this->buildPropertyDefinition($reflectionProperty);
		}

		return $classDefinition;
	}
86955
public function getMetadataFor(string $className) : ClassMetadata
    {
        if (isset($this->loadedMetadata[$className])) {
            return $this->loadedMetadata[$className];
        }

        // Check for namespace alias
        if (strpos($className, ':') !== false) {
            [$namespaceAlias, $simpleClassName] = explode(':', $className, 2);

            $realClassName = $this->getFqcnFromAlias($namespaceAlias, $simpleClassName);
        } else {
            $realClassName = $this->getRealClass($className);
        }

        if (isset($this->loadedMetadata[$realClassName])) {
            // We do not have the alias name in the map, include it
            return $this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName];
        }

        $loadingException = null;

        try {
            if ($this->cacheDriver !== null) {
                $cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt);

                if ($cached instanceof ClassMetadata) {
                    $this->loadedMetadata[$realClassName] = $cached;

                    $this->wakeupReflection($cached, $this->getReflectionService());
                } else {
                    foreach ($this->loadMetadata($realClassName) as $loadedClassName) {
                        $this->cacheDriver->save(
                            $loadedClassName . $this->cacheSalt,
                            $this->loadedMetadata[$loadedClassName]
                        );
                    }
                }
            } else {
                $this->loadMetadata($realClassName);
            }
        } catch (MappingException $loadingException) {
            $fallbackMetadataResponse = $this->onNotFoundMetadata($realClassName);

            if ($fallbackMetadataResponse === null) {
                throw $loadingException;
            }

            $this->loadedMetadata[$realClassName] = $fallbackMetadataResponse;
        }

        if ($className !== $realClassName) {
            // We do not have the alias name in the map, include it
            $this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName];
        }

        return $this->loadedMetadata[$className];
    }
602287
protected function isAggregateRoot($className, $propertySourceHint)
    {
        $className = $this->getUnproxiedClassName($className);
        try {
            $classSchema = $this->getClassSchema($className);

            return $classSchema->isAggregateRoot();
        } catch (ClassSchemaNotFoundException $exception) {
            throw new ClassSchemaNotFoundException('No class schema found for "' . $className . '". The class should probably marked as entity or value object! This happened while examining "' . $propertySourceHint . '"', 1340185197);
        }
    }
856774
private function resolveTypeName($className)
    {
        if (strpos($className, ':') !== false || strpos($className, '\\') !== false) {
            return $this->getMetadataCollector()->getDocumentType($className);
        }

        return $className;
    }
1076873
public function getByClassname(string $classname)
    {
        foreach ($this->container as $value) {
            if (is_object($value) && $value instanceof $classname) {
                return $value;
            }
        }

        return null;
    }
593587
public function getMetadataFor($className)
    {
        if (!$this->hasMetadataFor($className)) {
            $metadata = new ClassMetadata($className);
            $this->populateMetadata($metadata);
            $this->setMetadataFor($className, $metadata);
        }

        return $this->metadata[$className];
    }
1251249
public static function fromClass($className)
    {
        return new self(
            \Pheasant::instance()->schema($className),
            \Pheasant::instance()->finderFor($className)
        );
    }
308815
protected function _prepareSchema($fixtureClassName)
    {
        $fixture = new $fixtureClassName;
        if (!empty($fixture->table)) {
            $tableName = $fixture->table;
        } else {
            $tableName = (string)Inflector::underscore(str_replace_last('Fixture', '', $fixtureClassName));
        }

        list($fields, $constraints, $indexes, $options) = $this->_prepareSchemaProperties($fixture);
        $schema = new TableSchema($tableName, $fields);

        foreach ($constraints as $name => $attrs) {
            $schema->addConstraint($name, $attrs);
        }

        foreach ($indexes as $name => $attrs) {
            $schema->addIndex($name, $attrs);
        }

        if (!empty($options)) {
            $schema->options($options);
        }

        return $schema;
    }
158347
public function getMetadataFor($className)
    {
        if (!$this->isService($className)) {
            throw Exception::classIsNotMappedService($className);
        }

        if (!isset($this->loadedMetadata[$className])) {
            $this->loadMetadata($className);
        }

        if ($this->cache) {
            $cacheId = $this->cachePrefix . $className . $this->cacheSuffix;

            if (($cached = $this->cache->fetch($cacheId)) !== false) {
                $this->loadedMetadata[$className] = $cached;
            } else {
                $this->loadMetadata($className);
                $this->cache->save($cacheId, $this->loadedMetadata[$className], null);
            }
        } else {
            $this->loadMetadata($className);
        }

        return $this->loadedMetadata[$className];
    }
541286
protected static function getObject($className)
    {
        if (!isset(self::$instances[$className])) {
            self::$instances[$className] = self::createObject($className);
        }

        return self::$instances[$className];
    }
369870
public function getDocument($className)
    {
        if (isset($this->documents[$className])) {
            return $this->documents[$className];
        }
        if (!isset($this->mappings[$className])) {
            throw new \InvalidArgumentException(sprintf('No mapping found for document "%s"', $className));
        }

        return $this->documents[$className] = $this->processDocument(
            $className,
            $this->mappings[$className]['doctrine'],
            $this->mappings[$className]['serializer'],
            $this->mappings[$className]['schema']
        );
    }
1357777
public function getConfigs($className)
    {
        if (\is_object($className)) {
            $className = ClassUtils::getClass($className);
        }

        if (!array_key_exists($className, $this->configs)) {
            $this->configs[$className] = [[], []];
            $meta = $this->om->getClassMetadata($className);
            $this->addConfigFields($meta, $className);
            $this->addConfigAssociations($meta, $className);
        }

        return $this->configs[$className];
    }
74759
public function fetchAllClass(string $classname) : array
    {
        $this->stmt->setFetchMode(\PDO::FETCH_CLASS, $classname);
        return $this->stmt->fetchAll();
    }
701402
public static function getClassProfile($classname) {
		if (!array_key_exists($classname, self::$profiles))
			self::$profiles[$classname] = new ClassProfile($classname);
		
		return self::$profiles[$classname];
	}
1099385
public static function fromSchemaType( $qname )
	{
		$types = SchemaTypes::getInstance();
		$type = $types->getType( "{$qname->prefix}:{$qname->localName}" );

		if ( ! $type ) return null;

		$datatype = new DOMSchemaDatatype( "{$qname->prefix}:{$qname->localName}" );
		$result = new DOMSchemaSimpleType( $qname, $datatype );
		return $result;
	}