protected function packDefaults(SchemaBuilder $builder, array $overwriteDefaults = []): array
    {
        //Defined compositions
        $compositions = $this->getCompositions($builder);

        //User defined default values
        $userDefined = $overwriteDefaults + $this->getDefaults();

        //We need mutators to normalize default values
        $mutators = $this->getMutators();

        $defaults = [];
        foreach ($this->getFields() as $field => $type) {
            $default = is_array($type) ? [] : null;

            if (array_key_exists($field, $userDefined)) {
                //No merge to keep fields order intact
                $default = $userDefined[$field];
            }

            //Registering default values
            $defaults[$field] = $this->mutateValue(
                $builder,
                $compositions,
                $userDefined,
                $mutators,
                $field,
                $default
            );
        }

        return $defaults;
    }
protected function packDefaults(SchemaBuilder $builder, array $overwriteDefaults = []): array
    {
        //Defined compositions
        $compositions = $this->getCompositions($builder);

        //User defined default values
        $userDefined = $overwriteDefaults + $this->getDefaults();

        //We need mutators to normalize default values
        $mutators = $this->getMutators();

        $defaults = [];
        foreach ($this->getFields() as $field => $type) {
            $default = is_array($type) ? [] : null;

            if (array_key_exists($field, $userDefined)) {
                //No merge to keep fields order intact
                $default = $userDefined[$field];
            }

            //Registering default values
            $defaults[$field] = $this->mutateValue(
                $builder,
                $compositions,
                $userDefined,
                $mutators,
                $field,
                $default
            );
        }

        return $defaults;
    }
protected function packDefaults ( SchemaBuilder $ builder , array $ overwriteDefaults = [ ] ) : array { //Defined compositions $ compositions = $ this -> getCompositions ( $ builder ) ; //User defined default values $ userDefined = $ overwriteDefaults + $ this -> getDefaults ( ) ; //We need mutators to normalize default values $ mutators = $ this -> getMutators ( ) ; $ defaults = [ ] ; foreach ( $ this -> getFields ( ) as $ field => $ type ) { $ default = is_array ( $ type ) ? [ ] : null ; if ( array_key_exists ( $ field , $ userDefined ) ) { //No merge to keep fields order intact $ default = $ userDefined [ $ field ] ; } //Registering default values $ defaults [ $ field ] = $ this -> mutateValue ( $ builder , $ compositions , $ userDefined , $ mutators , $ field , $ default ) ; } return $ defaults ; }
Entity default values.

@param SchemaBuilder $builder
@param array         $overwriteDefaults Set of default values to replace user defined values.

@return array

@throws SchemaException
Entity default values .