public static function factory(array $data)
    {
        $type = ucfirst(strtolower($data['data_type']));
        $args = self::parseArray($data);

        // Execute hook to allow for additional column types or modifications
        $classname = __NAMESPACE__ . "\\" . ucfirst(strtolower($args['type']));
        $params = Hook::execute(
            'Wedeto.DB.Schema.Column.Column.FindClass', 
            ['column_defition' => $args, 'input_data' => $data, 'classname' => $classname, 'instance' => null]
        );

        // Check if a hook has already provided an instance
        if ($params['instance'] !== null && $params['instance'] instanceof Column)
            return $params['instance'];

        // Get the selected classname
        $classname = $params['classname'];
        if (!class_exists($classname))
            throw new InvalidTypeException("Unsupported column type: " . $args['type'] . " (class $classname not found)");

        $col = new $classname($args['name']);
        foreach ($args as $property => $value)
        {
            if (!empty($value))
                $col->set($property, $value);
        }

        return $col;
    }
public static function factory(array $data)
    {
        $type = ucfirst(strtolower($data['data_type']));
        $args = self::parseArray($data);

        // Execute hook to allow for additional column types or modifications
        $classname = __NAMESPACE__ . "\\" . ucfirst(strtolower($args['type']));
        $params = Hook::execute(
            'Wedeto.DB.Schema.Column.Column.FindClass', 
            ['column_defition' => $args, 'input_data' => $data, 'classname' => $classname, 'instance' => null]
        );

        // Check if a hook has already provided an instance
        if ($params['instance'] !== null && $params['instance'] instanceof Column)
            return $params['instance'];

        // Get the selected classname
        $classname = $params['classname'];
        if (!class_exists($classname))
            throw new InvalidTypeException("Unsupported column type: " . $args['type'] . " (class $classname not found)");

        $col = new $classname($args['name']);
        foreach ($args as $property => $value)
        {
            if (!empty($value))
                $col->set($property, $value);
        }

        return $col;
    }
public static function factory ( array $ data ) { $ type = ucfirst ( strtolower ( $ data [ 'data_type' ] ) ) ; $ args = self :: parseArray ( $ data ) ; // Execute hook to allow for additional column types or modifications $ classname = __NAMESPACE__ . "\\" . ucfirst ( strtolower ( $ args [ 'type' ] ) ) ; $ params = Hook :: execute ( 'Wedeto.DB.Schema.Column.Column.FindClass' , [ 'column_defition' => $ args , 'input_data' => $ data , 'classname' => $ classname , 'instance' => null ] ) ; // Check if a hook has already provided an instance if ( $ params [ 'instance' ] !== null && $ params [ 'instance' ] instanceof Column ) return $ params [ 'instance' ] ; // Get the selected classname $ classname = $ params [ 'classname' ] ; if ( ! class_exists ( $ classname ) ) throw new InvalidTypeException ( "Unsupported column type: " . $ args [ 'type' ] . " (class $classname not found)" ) ; $ col = new $ classname ( $ args [ 'name' ] ) ; foreach ( $ args as $ property => $ value ) { if ( ! empty ( $ value ) ) $ col -> set ( $ property , $ value ) ; } return $ col ; }
Create a column instance from an array.
@param array $data The column specification containing name. type,
maximum length, numeric scale and precision, default
value, nullability and such.
@return Column An instantiated column object
Create a column instance from an array .