We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Model::assign behaviour

@phalcon, Current behaviour of Model::assign

    $robot = new Robot(); //Robot model from tests
    $robot->assign(array(
        'field1' => 'mechanical',
        'field2' => 2018
    ));

    //$robot->field1 == 'mechanical'
    //$robot->field2 == 2018

I.e. if columnMap not passed, any key of data is assigned to property of object. Should Model::assign check if keys of array exist in attributes?



98.9k

Check if a key exists in attributes would be a good addition.