LogicException Table does not have a primary key

Member | 59

Hi, is there any way to disable the PK check please? I use the ublaboo/datagrid and \PdfResponse libraries, and in practice it turns out that it is much more convenient to use view to display data (which contains dozens of joins and conditions) than to write joins in PHP for both practical and functional reasons, reusability and uniform placement. Moreover, it is not possible to write advanced joins in PHP that would support e.g. “outer apply” (in MSSQL). View obviously don't have a primary ID. I also use tabular functions to stretch data to datagrid/PDF, which also don't have PK. I have $grid->setPrimaryKey(‘<id>’) defined in datagrid, but still this error returns from time to time and quite regularly. I have stored the id as a persistent parameter. It's pretty stupid to instruct users to try clicking the button again in case it doesn't work…


  1. It is probably most appropriate to only check for the existence of PKs for tables and not for views, table functions, etc.
  2. To be able to specify directly at db model level a column with PK
  3. Or that the error be shown as a warning in the log and not as an error to the user.

I understand that IDs are used for the following reasons: speed, paging, to ensure correct identification during update/insert. But in the view primary it is not possible to specify the ID…