Welcome Guest, Not a member yet? Register   Sign In
DataCaster not working
#3

(This post was last modified: 05-06-2024, 01:28 AM by ozornick.)

This happens in the Model. I get the data in the form of an entity.
PHP Code:
final class SettingsParameter extends Entity
{
    private ?int $id null;
    private string $parameter;
    private string $value;
    private ?string $description;
    protected $casts = [
        'id'          => '?int',
        'parameter'  => 'string',
        'value'      => 'string',
        'description' => '?string',
    ];

    public function getId(): ?int
    
{
        return $this->id;
    

For getId() I can't get ?int
So I need to move the $cast parameter to the Model? Can this affect the entity in the future?
Simple CI 4 project for beginners codeigniter-expenses ( topic )
Reply


Messages In This Thread
DataCaster not working - by ozornick - 05-05-2024, 07:14 AM
RE: DataCaster not working - by kenjis - 05-05-2024, 04:50 PM
RE: DataCaster not working - by ozornick - 05-06-2024, 01:19 AM
RE: DataCaster not working - by kenjis - 05-06-2024, 01:38 AM
RE: DataCaster not working - by ozornick - 05-06-2024, 02:20 AM
RE: DataCaster not working - by kenjis - 05-06-2024, 03:16 AM
RE: DataCaster not working - by Thomas Meschke - 06-13-2024, 06:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB