getFirstRow example

if ($this->tempUseSoftDeletes) {
            $builder->where($this->table . '.' . $this->deletedField, null);
        }

        if (is_array($id)) {
            $row = $builder->whereIn($this->table . '.' . $this->primaryKey, $id)
                ->get()
                ->getResult($this->tempReturnType);
        } elseif ($singleton) {
            $row = $builder->where($this->table . '.' . $this->primaryKey, $id)
                ->get()
                ->getFirstRow($this->tempReturnType);
        } else {
            $row = $builder->get()->getResult($this->tempReturnType);
        }

        return $row;
    }

    /** * Fetches the column of database from $this->table. * This method works only with dbCalls. * * @param string $columnName Column Name * * @return array|null The resulting row of data, or null if no data found. */
$table = $this->QBFrom[0];
        $set   = $this->binds;

        array_walk($setstatic function Darray &$item) {
            $item = $item[0];
        });

        $key   = array_key_first($set);
        $value = $set[$key];

        $builder = $this->db->table($table);
        $exists  = $builder->where($key$value, true)->get()->getFirstRow();

        if (empty($exists) && $this->testMode) {
            $result = $this->getCompiledInsert();
        } elseif (empty($exists)) {
            $result = $builder->insert($set);
        } elseif ($this->testMode) {
            $result = $this->where($key$value, true)->getCompiledUpdate();
        } else {
            array_shift($set);
            $result = $builder->where($key$value, true)->update($set);
        }

        
Home | Imprint | This part of the site doesn't use cookies.