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

Hi. There is an error when converting DataСaster types for an Entity, the set() method is not specified. Because of this, type casting does not work. 
Look at this https://github.com/codeigniter4/CodeIgni...st.php#L24
My code Entity: 

PHP Code:
// Step 1, fill properties
$entity->fill($data);
// Step 2 run Entity->__set($value)

// See https://github.com/codeigniter4/CodeIgniter4/blob/fd9cb65c23c047d2a65203d9f602fe34902d48f0/system/Entity/Entity.php#L165

// Step 3 call Cast
// https://github.com/codeigniter4/CodeIgniter4/blob/fd9cb65c23c047d2a65203d9f602fe34902d48f0/system/Entity/Entity.php#L434
$value $this->castAs($value$dbColumn'set'); 

But some Casts (IntegerCast, FloatCast, ...) don't have a set (only get) method and everything breaks
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