analogue icon indicating copy to clipboard operation
analogue copied to clipboard

`morphTo` causes issues if there is no morphable `_type` defined

Open smallhadroncollider opened this issue 7 years ago • 0 comments

I have a Document class with a documentable morphTo relationship.

If I try to access $document->documentable when the documentable_type column is NULL I get two different issues, depending on the context.


  1. A Class not found exception

This seems to be caused because the $class variable cannot get a value in the morphTo method of EntityMap


  1. A SQLSTATE[42S22]: Column not found: 1054 Unknown column 'documents.' in 'where clause' (SQL: select *,idfromdocumentswheredocuments.``is null limit 1)

Trying to select with a blank column name, presumably as the column name cannot be set from anywhere.

smallhadroncollider avatar Jul 18 '16 15:07 smallhadroncollider