Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 4 Model set() returns error
#3

(This post was last modified: 03-27-2024, 11:30 PM by MZahov.)

If I use array not entity it works fine.

This function is inside "vendor\codeigniter4\framework\system\Model.php"

PHP Code:
    /**
    * Captures the builder's set() method so that we can validate the
    * data here. This allows it to be used with any of the other
    * builder methods and still get validated data, like replace.
    *
    * @param array|object|string              $key    Field name, or an array of field/value pairs
    * @param bool|float|int|object|string|null $value  Field value, if $key is a single field
    * @param bool|null                        $escape Whether to escape values
    *
    * @return $this
    */
    public function set($key$value '', ?bool $escape null)
    {
        $data is_array($key) ? $key : [$key => $value]; // This line

        foreach (array_keys($data) as $k) {
            $this->tempData['escape'][$k] = $escape;
        }

        $this->tempData['data'] = array_merge($this->tempData['data'] ?? [], $data);

        return $this;
    
Reply


Messages In This Thread
RE: Codeigniter 4 Model set() returns error - by MZahov - 03-27-2024, 11:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB