Closed ahmadazimi closed 6 years ago
I've just open commented on Laravel issue [https://github.com/laravel/framework/issues/15892#issuecomment-255517921] They said the similar problem was fixed before but work in my case!
laravel version: 5.3.19 jenssegers/laravel-mongodb version: 3.1.1
+1. Rolled back to Laravel v5.3.18, which works.
@ellej16 make a comment on that Laravel issue:
As far as I checked jensessegers/laravel-mongodb's source code, it's missing a few key methods/attributes introduced by this particular PR: #15780 . If I remember correctly, one of those are: getSchemaGrammar() and useDefaultSchemaGrammar() on Connection.php (With this being the culprit behind your troubles).
Is there any chance to fix it here?
@ahmadazimi Below is the fix to your issue:
Go to Connection.php which can be found in the Mongodb folder of this package and add these changes:
1) Add use Jenssegers\Mongodb\Schema\Grammar;
right below the use MongoDB\Client;
.
2) Inside the public function __construct(array $config)
function, add $this->schemaGrammar = new Grammar();
. It can come before any other code in the function.
Now head over to the Schema folder and create a new file called Grammar.php. The file should contain this:
<?php
namespace Jenssegers\Mongodb\Schema;
use Illuminate\Database\Schema\Grammars\Grammar as BaseGrammar;
/**
* Class Grammar
*
* @package Moloquent\Schema
*/
class Grammar extends BaseGrammar
{
}
I found this fix in the moloquent fork of this package (https://github.com/moloquent/moloquent). Hope this helps you.
Thank you @kofispaceman I think I should switch to https://github.com/moloquent/moloquent ;-)
Was this fixed in the last Laravel release, or still an issue?
@jenssegers using Laravel v5.3.21 and jenssegers/mongodb v3.1.1
and still this is an issue!
Can you try the master branch?
@jenssegers Looks like it has been fixed in the master branch. Thanks!
@jenssegers Looks like it has been fixed in the master branch.
Thanks.
@jenssegers when we can have it in stable channel?
Will do this now
Hi there,
I've just upgraded to Laravel 5.3 and also upgraded
laravel-mongodb
to 3.1.1. Now when I'm trying to migrate the following error occurred:I've set
protected $connection = 'mongodb';
in my migration class.BTW:
up()
method never fired, the error occurred before it I think.