Welcome Guest, Not a member yet? Register   Sign In
Entity add custom properties
#4

I'll start with the second question.
The Model::insertBatch() method solves your problem. This method will remove fields from the dataset that do not exist in the database table. If you still want to use the QueryBuilder directly, you must clean up the data yourself.

I still don't understand the situation. Excuse me.
When you find an object using the Model::find() method, you add the "user" attribute to the entity.
The only moment when this attribute will not be defined for you is at the moment of creating a new entity.
But it is logical that during creation you will assign the current user to it. So I don’t see the point in the stub (creating an empty user in the constructor), since when exporting (toArray()) it is converted to an empty array.

"To avoid warning." What do you mean?
Reply


Messages In This Thread
Entity add custom properties - by ozornick - 09-04-2022, 12:35 AM
RE: Entity add custom properties - by iRedds - 09-05-2022, 12:03 AM
RE: Entity add custom properties - by ozornick - 09-05-2022, 10:02 AM
RE: Entity add custom properties - by iRedds - 09-05-2022, 05:37 PM
RE: Entity add custom properties - by ozornick - 09-06-2022, 12:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB