public function findPrimary(bool $sameCollection = true): string
    {
        $primary = $this->schema->getClass();
        foreach ($this->schemas as $schema) {
            //Only Document and DocumentEntity classes supported
            if (!$schema instanceof DocumentSchema) {
                continue;
            }

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

                $primary = $schema->getClass();
            }
        }

        return $primary;
    }
public function findPrimary(bool $sameCollection = true): string
    {
        $primary = $this->schema->getClass();
        foreach ($this->schemas as $schema) {
            //Only Document and DocumentEntity classes supported
            if (!$schema instanceof DocumentSchema) {
                continue;
            }

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

                $primary = $schema->getClass();
            }
        }

        return $primary;
    }
public function findPrimary ( bool $ sameCollection = true ) : string { $ primary = $ this -> schema -> getClass ( ) ; foreach ( $ this -> schemas as $ schema ) { //Only Document and DocumentEntity classes supported if ( ! $ schema instanceof DocumentSchema ) { continue ; } if ( $ this -> schema -> getReflection ( ) -> isSubclassOf ( $ schema -> getClass ( ) ) ) { if ( $ sameCollection && ! $ this -> compareCollection ( $ schema ) ) { //Child changed collection or database continue ; } $ primary = $ schema -> getClass ( ) ; } } return $ primary ; }
Find primary class needed to represent model and model childs.

@param bool $sameCollection Find only parent related to same collection as model.

@return string
Find primary class needed to represent model and model childs .