rainlab/builder-plugin

Custom types (looking to contribute)

ClickerMonkey opened this issue · 5 comments

I'm looking to update this plugin so you can add custom types. The end goal is so I can create a plugin (or maybe it could be a part of this plugin if you guys thinks it's a good idea) for GIS types, functions, inputs, components, etc.

Would you guys be open to this?

If so, should I make everything extendable by using Events, specific functions added to the plugin, or modify the code of this plugin to be more injectable. For example:

https://github.com/rainlab/builder-plugin/blob/master/classes/MigrationColumnType.php#L49

These functions return an array. They could trigger an event before returning the array to modify it. Or they could be changed to a static variable so types can be added. Or they could be imported from somewhere else in the code in charge of the supported types in the plugin - and a user would only need to interact with that class.

Thoughts?

@ClickerMonkey could you provide more information on what exactly you mean by "custom types"? This plugin already has a few events that allow you to do things like add support for custom formwidgets

self::TYPE_INTEGER => DoctrineType::INTEGER,
            self::TYPE_SMALLINTEGER => DoctrineType::SMALLINT,
            self::TYPE_BIGINTEGER => DoctrineType::BIGINT,
            self::TYPE_DATE => DoctrineType::DATE,
            self::TYPE_TIME => DoctrineType::TIME,
            self::TYPE_DATETIME => DoctrineType::DATETIME,
            self::TYPE_TIMESTAMP => DoctrineType::DATETIME,
            self::TYPE_STRING => DoctrineType::STRING,
            self::TYPE_TEXT => DoctrineType::TEXT,
            self::TYPE_BINARY => DoctrineType::BLOB,
            self::TYPE_BOOLEAN => DoctrineType::BOOLEAN,
            self::TYPE_DECIMAL => DoctrineType::DECIMAL,
            self::TYPE_DOUBLE => DoctrineType::FLOAT

The end goal is to allow other database types - there are points, shapes, arrays, objects, etc.

https://www.doctrine-project.org/api/dbal/2.9/Doctrine/DBAL/Types/Type.html

formwidgets are only for taking input on the existing defined data types - I want to add data types not currently defined in the Builder plugin.

@bennothommo any thoughts on this?

@ClickerMonkey I'd be happy to hear your proposal on the events that would be needed to make this more extendable, but I don't think we'd be able to accept custom field types being added directly into the plugin.

It's my understanding that once you start dealing with geometric data in databases, it's where all the supported database server types start to massively diverge (ie. MySQL supports them out of the box, SQLite needs Spatialite, Postgres uses some different terminology, etc.)

Closing as it has been over a month since any activity on this occurred and we are trying to figure out what issues are still relevant. If this is still something that you would like to see through to fruition please respond and we can get the ball rolling.