Call to a member function compileColumnExists()
acidjazz opened this issue · comments
Setup is the latest version of Lumen with mongodb.
I'm 99% sure I have everything setup right from your example and I get:
Fatal error: Call to a member function compileColumnExists() on null in /Users/k/opsis/vendor/illuminate/database/Schema/Builder.php on line 116
With this data it is impossible for me to determine what's wrong or if this is even an issue related to this library. I need context.
Some code + laravel-mongodb version + laravel5-jsonapi version, please?
Apologies,
laravel-mongodb version is v3.0
laravel5-jsonapi version is v2.4
Doing some research it seems as if null is being passed instead of a Grammar instance?
More details:
Lumen service provider include:
$app->register(\NilPortugues\Laravel5\JsonApi\Laravel5JsonApiServiceProvider::class);
$app->configure('jsonapi');
jsonapi configuration file
<?php
use App\Transformers\ItemTransformer;
return [ ItemTransformer::class, ];
routes.php
$app->get('/', ['as' => 'home', 'uses' => 'Home@index']);
$app->group(
['namespace' => 'App\Http\Controllers'], function($app) {
$app->get(
'items', [
'as' => 'item.index',
'uses' =>'ItemController@index'
]);
$app->get(
'item/{item_id}', [
'as' => 'item.show',
'uses' =>'ItemController@show'
]);
}
);
Transformer
<?php
namespace App\Transformers;
use App\Models\Item;
use NilPortugues\Api\Mappings\JsonApiMapping;
class ItemTransformer implements JsonApiMapping
{
public function getClass() {
return Item::class;
}
public function getAlias() {
return 'item';
}
public function getAliasedProperties() {
return [];
}
public function getHideProperties() {
return [];
}
public function getIdProperties() {
return ['id'];
}
public function getUrls() {
return [
'self' => ['name' => 'item.show', 'as_id' => 'id'],
'items' => ['name' => 'item.index'],
];
}
public function getRelationships() {
return [];
}
}
Controller
<?php
namespace App\Http\Controllers;
use App\Models\Item;
use NilPortugues\Laravel5\JsonApi\Controller\LumenJsonApiController;
class ItemController extends LumenJsonAPiController
{
public function index() {
}
public function getdataModel() {
return new Item();
}
}
and my model
namespace App\Models;
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Illuminate\Foundation\Validation\ValidatesRequests;
class Item extends Eloquent
{
public $timestamps = false;
protected $collection = 'item';
protected $primaryKey = 'id';
protected $appends = [];
protected $dates = [
'dates.created',
'dates.updated'
];
protected $fillable = [
'title',
'image',
'creator',
'subjects',
'dates',
];
}
@acidjazz does this happen if you turn off or default non-dot field names for $dates?
I believe the problem on the lib is there from the code you posted. Just to make sure.