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

Hello. I'd like to add a custom property (another object) when requesting find(), findAll() ...
How is this possible within the framework?

If you add public $user - will not be shown in toArray()
The protected $attributes property is not allowed - these are the names of the fields from the table
There is only one way left - to immediately assign $this->user = new User() But I would like to have an initial value as for $attributes = ['user'  => null]
Simple CI 4 project for beginners codeigniter-expenses
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