PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, February 13, 2022

[FIXED] Error when fetching MSSQL database view data CakePHP 3

 February 13, 2022     cakephp, cakephp-3.0, php, sql-server     No comments   

Issue

I have experience in using cakephp 2 but i have no idea in cakephp 3.

My database admin keep creating database table with uppercase name even in column name, so i have to make cakephp model with custom table/view name.

<?php
namespace App\Model\Table;

use Cake\ORM\Table;

class ListCrewBooking extends Table
{
    public function initialize(array $config)
    {
        $this->table('VW_CREW_ON_DUTY');
    }
}

and then i want to preview it on a controller directly without a cake view (using die();)

class TestController extends AppController
{
    function index(){

        $this->viewBuilder()->layout = false;
        $this->loadModel('ListCrewBooking');

        $data = $this->ListCrewBooking->find('all');
        pr($data);
        die();
    }
}

and then an error comes out

Cannot describe list_crew_booking. It has 0 columns.

Why this is happened? and how to solve this? i have no clue what is going on.

ps: the view have 5000 rows and many columns

Thank you for any reply


Solution

Currently Cake 3 is not able to inspect views in the database when using the Sql server driver. There was a pull request for it, but was abandoned by the author. Maybe, if you have knowledge of this database, you can contribute this feature?



Answered By - José Lorenzo Rodríguez
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing