Welcome Guest, Not a member yet? Register   Sign In
Entity - allowedFields add functionality
#1

As per https://forum.codeigniter.com/forum-29.html
I thought by adding $allowedFields to an entity that an Entity would behave similar to a Model.
(Indeed I thought that defining $attributes was the same thing as defining $allowedFields in the context of an Entity.)
  • I think that $allowedFields functionality for an entity would be useful. This allows Entities to be more useful in their own right - helpful to standardise inputs to an expected format for interfaces aside from dbs.

Indeed I think from a design perspective that when defining an Entity as per my understanding:

Quote:"At its core, an Entity class is simply a class that represents a single database row." 

Therefore when we are defining fields using $attributes in an Entity shouldn't we effectively be setting the $allowedFields of that database row? 

I think a good implementation would be to have $eligibleFields for Entities and $allowedFields for Models where if $allowedFields is not blank that it takes precedence.
(Typically where an Entity is defined as the $returnType of a Model then that is the place for fields to defined rather than at the model level.)
Whats are your thoughts?
Reply


Messages In This Thread
Entity - allowedFields add functionality - by maximusto - 08-29-2021, 06:19 PM



Theme © iAndrew 2016 - Forum software by © MyBB