public function dataTypesGet( $filter = null )
    {

        // array of string
        if( func_num_args() > 1 and \Bond\array_check( 'is_string', func_get_args() ) ) {
            $filter = func_get_args();
        }

        // filter constants
        if( is_int( $filter ) ) {

            $dataTypes = array();

            if( $filter & DataType::PRIMARY_KEYS ) {
                $dataTypes += array_filter(
                    $this->dataTypes,
                    function( $dataType ) {
                        return $dataType->isPrimaryKey();
                    }
                );
            }

            if( $filter & DataType::FORM_CHOICE_TEXT ) {
                $dataTypes += array_filter(
                    $this->dataTypes,
                    function( $dataType ) {
                        return $dataType->isFormChoiceText();
                    }
                );
            }

            if( $filter & DataType::AUTOCOMPLETE ) {
                $dataTypes += array_filter(
                    $this->dataTypes,
                    function( $dataType ) {
                        return $dataType->isAutoComplete();
                    }
                );
            }

            // todo. build a datatype from the $this->links et al
            if( $filter & DataType::LINKS ) {
            }

            return $dataTypes;

        }

        if( is_string( $filter ) ) {
            $filter = array( $filter );
        }

        if( is_array($filter) ) {

            $result = array_intersect_key( $this->dataTypes, array_flip( $filter ) );

            if ( count($result) != count($filter) ) {
                throw new \InvalidArgumentException(
                    sprintf(
                        'Unknown columns "%s" passed to %s->dataTypesGet()',
                        implode( '","', array_diff( $filter, array_keys( $result ) ) ),
                        $this->entity
                    )
                );
            }

            return $result;
        }

        if( $filter instanceof \Closure ) {
            return array_filter( $this->dataTypes, $filter );
        }

        return $this->dataTypes;
    }
public function dataTypesGet( $filter = null )
    {

        // array of string
        if( func_num_args() > 1 and \Bond\array_check( 'is_string', func_get_args() ) ) {
            $filter = func_get_args();
        }

        // filter constants
        if( is_int( $filter ) ) {

            $dataTypes = array();

            if( $filter & DataType::PRIMARY_KEYS ) {
                $dataTypes += array_filter(
                    $this->dataTypes,
                    function( $dataType ) {
                        return $dataType->isPrimaryKey();
                    }
                );
            }

            if( $filter & DataType::FORM_CHOICE_TEXT ) {
                $dataTypes += array_filter(
                    $this->dataTypes,
                    function( $dataType ) {
                        return $dataType->isFormChoiceText();
                    }
                );
            }

            if( $filter & DataType::AUTOCOMPLETE ) {
                $dataTypes += array_filter(
                    $this->dataTypes,
                    function( $dataType ) {
                        return $dataType->isAutoComplete();
                    }
                );
            }

            // todo. build a datatype from the $this->links et al
            if( $filter & DataType::LINKS ) {
            }

            return $dataTypes;

        }

        if( is_string( $filter ) ) {
            $filter = array( $filter );
        }

        if( is_array($filter) ) {

            $result = array_intersect_key( $this->dataTypes, array_flip( $filter ) );

            if ( count($result) != count($filter) ) {
                throw new \InvalidArgumentException(
                    sprintf(
                        'Unknown columns "%s" passed to %s->dataTypesGet()',
                        implode( '","', array_diff( $filter, array_keys( $result ) ) ),
                        $this->entity
                    )
                );
            }

            return $result;
        }

        if( $filter instanceof \Closure ) {
            return array_filter( $this->dataTypes, $filter );
        }

        return $this->dataTypes;
    }
public function dataTypesGet ( $ filter = null ) { // array of string if ( func_num_args ( ) > 1 and \ Bond \ array_check ( 'is_string' , func_get_args ( ) ) ) { $ filter = func_get_args ( ) ; } // filter constants if ( is_int ( $ filter ) ) { $ dataTypes = array ( ) ; if ( $ filter & DataType :: PRIMARY_KEYS ) { $ dataTypes += array_filter ( $ this -> dataTypes , function ( $ dataType ) { return $ dataType -> isPrimaryKey ( ) ; } ) ; } if ( $ filter & DataType :: FORM_CHOICE_TEXT ) { $ dataTypes += array_filter ( $ this -> dataTypes , function ( $ dataType ) { return $ dataType -> isFormChoiceText ( ) ; } ) ; } if ( $ filter & DataType :: AUTOCOMPLETE ) { $ dataTypes += array_filter ( $ this -> dataTypes , function ( $ dataType ) { return $ dataType -> isAutoComplete ( ) ; } ) ; } // todo. build a datatype from the $this->links et al if ( $ filter & DataType :: LINKS ) { } return $ dataTypes ; } if ( is_string ( $ filter ) ) { $ filter = array ( $ filter ) ; } if ( is_array ( $ filter ) ) { $ result = array_intersect_key ( $ this -> dataTypes , array_flip ( $ filter ) ) ; if ( count ( $ result ) != count ( $ filter ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Unknown columns "%s" passed to %s->dataTypesGet()' , implode ( '","' , array_diff ( $ filter , array_keys ( $ result ) ) ) , $ this -> entity ) ) ; } return $ result ; } if ( $ filter instanceof \ Closure ) { return array_filter ( $ this -> dataTypes , $ filter ) ; } return $ this -> dataTypes ; }
Helper function. Get dataTypes for this Entity.
@return array
Helper function . Get dataTypes for this Entity .