public function findChildren(bool $sameCollection = false, bool $directChildren = false)
    {
        $result = [];
        foreach ($this->schemas as $schema) {
            //Only Document and DocumentEntity classes supported
            if (!$schema instanceof DocumentSchema) {
                continue;
            }

            //ReflectionEntity
            $reflection = $schema->getReflection();

            if ($reflection->isSubclassOf($this->schema->getClass())) {

                if ($sameCollection && !$this->compareCollection($schema)) {
                    //Child changed collection or database
                    continue;
                }

                if (
                    $directChildren
                    && $reflection->getParentClass()->getName() != $this->schema->getClass()
                ) {
                    //Grandson
                    continue;
                }

                $result[] = $schema;
            }
        }

        return $result;
    }
public function findChildren(bool $sameCollection = false, bool $directChildren = false)
    {
        $result = [];
        foreach ($this->schemas as $schema) {
            //Only Document and DocumentEntity classes supported
            if (!$schema instanceof DocumentSchema) {
                continue;
            }

            //ReflectionEntity
            $reflection = $schema->getReflection();

            if ($reflection->isSubclassOf($this->schema->getClass())) {

                if ($sameCollection && !$this->compareCollection($schema)) {
                    //Child changed collection or database
                    continue;
                }

                if (
                    $directChildren
                    && $reflection->getParentClass()->getName() != $this->schema->getClass()
                ) {
                    //Grandson
                    continue;
                }

                $result[] = $schema;
            }
        }

        return $result;
    }
public function findChildren ( bool $ sameCollection = false , bool $ directChildren = false ) { $ result = [ ] ; foreach ( $ this -> schemas as $ schema ) { //Only Document and DocumentEntity classes supported if ( ! $ schema instanceof DocumentSchema ) { continue ; } //ReflectionEntity $ reflection = $ schema -> getReflection ( ) ; if ( $ reflection -> isSubclassOf ( $ this -> schema -> getClass ( ) ) ) { if ( $ sameCollection && ! $ this -> compareCollection ( $ schema ) ) { //Child changed collection or database continue ; } if ( $ directChildren && $ reflection -> getParentClass ( ) -> getName ( ) != $ this -> schema -> getClass ( ) ) { //Grandson continue ; } $ result [ ] = $ schema ; } } return $ result ; }
Get Document child classes.

Example:
Class A
Class B extends A
Class D extends A
Class E extends D

Result: B, D, E

@see getPrimary()

@param bool $sameCollection Find only children related to same collection as parent.
@param bool $directChildren Only child extended directly from current document.

@return DocumentSchema[]
Get Document child classes .