Skip to content

Data does not appear if fetched from table name with dot symbol #37

@rachyharkov

Description

@rachyharkov

Bug Description

All data from query result wont simply return the all column of the data, resulting only show the data which is came from add() method (but the amount of data is correct).

As my investigation goes, this is caused by table which is placed on different schema (for ex: the data shown up if the table is from "public" schema instead of "other_public" schema)

My Code

In controller

$db = db_connect();
$query = $this->table('other_public.users')

return DataTable::of($builder)
                ->add('my_custom_field', function($row) {
                    return 'some text'
                })
                ->toJson(true);
 

if using model, here is what it looks like:

Model

class Announcement extends Model
{
    protected $DBGroup          = 'default';
    protected $table            = 'cms.announcements';
    protected $primaryKey       = 'id';
    protected $useAutoIncrement = true;
    protected $returnType       = 'object';

}

Controller

class Announcement extends BaseController
{
    protected $announcement_model;

    function __construct()
    {
        $this->announcement_model = new ModelsAnnouncement();
    }

    public function index()
    {
            return DataTable::of($query)
                ->add('my_custom_field', function($row) {
                    return 'some text';
                })
                ->toJson(true);
    }
}

Screenshots
image

but if you check the query result using dd or whatever, it shows all the data

  • PHP Version: 7.4
  • CodeIgniter version: 4.3.6
  • Library version: 0.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions