I was talking about Kevin Cupp at EE conf about this and I also want to formalize the request here. I would love see some abstraction of the model concept so that we could have different types of models with much of the same base functionality.
For instance, Yii has a concept of “models”, which are simply for modeling data and you can attach any methods, validation, what have you, to that model. So you instantiate your model class, populate it with data where you can have methods to format the data on set or get, and you can validate the data in the model etc. This is all completely decoupled from any data source. This concept is just data.
Then Yii has a concept of “records”. These classes are an extension of models. They essentially are models, but they have a data source — the database. This is essentially what models in EE are now.
Models are great but I do frequently have a need to model data or put together a modeling of data that does not have a data source. So I would love to see if this is something we could see/do in EE. It seems like the components are there for this to work and it would just be a slight restructuring (even non-breaking I think) to add the ability to have a model without a data source from the database.
What do you guys at EL think?
This sounds like a big win for developers and by extension EE users. The flexibility Yii-like “Models” would bring certainly would be very welcome indeed. I don’t know what framework the current EE3 software is based on, but I assume of course that it’s a highly customized CodeIgniter implementation. Regardless, if it’s doable within the EE3 lifespan and EL isn’t working on moving EE to a newer bespoke solution (or another framework entirely) with this type of functionality already built in, then go for it EL.
Except for the database connection, EE3’s models do not inherit nor were based on any CodeIgniter architecture. They are currently tied pretty heavily to being in a database, requiring primary keys, tables, etc., but there is definite appeal to making the database itself a implementation detail that models themselves do not care about.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.