analogue
analogue copied to clipboard
`morphTo` causes issues if there is no morphable `_type` defined
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.
- A
Class not found
exception
This seems to be caused because the $class
variable cannot get a value in the morphTo
method of EntityMap
- A
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'documents.' in 'where clause' (SQL: select *,
idfrom
documentswhere
documents.``is null limit 1)
Trying to select with a blank column name, presumably as the column name cannot be set from anywhere.