Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter 1 to MongoCollection::insert() expected to be a reference, value given #603

Closed
fuzeboxsoftware opened this issue Sep 29, 2015 · 1 comment

Comments

@fuzeboxsoftware
Copy link

No idea what the issue is here:

        if(!empty($service_attrs)){
        $sid = DB::collection('surveys')->insertGetId( array(
            'name' => Input::get('survey_name'),
        'survey_question' => Input::get('survey_question'),
        'answers' => $answers,
        'service' => array(
            'name' => Input::get('service'),
            'attrs' => $service_attrs
        ),
        'custom_thanks' => Input::get('custom_thanks'),
        'notify' => ((Input::get('notify') == 1) ? 1 : 0),
        'accountid' => Session::get('uid'),
        'date_created' => new DateTime(),
        'date_updated' => new DateTime()
        ));
        }
        else{
            $sid = DB::collection('surveys')->insertGetId( array(
            'name' => Input::get('survey_name'),
        'survey_question' => Input::get('survey_question'),
        'answers' => $answers,
        'custom_thanks' => Input::get('custom_thanks'),
        'notify' => ((Input::get('notify') == 1) ? 1 : 0),
        'accountid' => Session::get('uid'),
        'date_created' => new DateTime(),
        'date_updated' => new DateTime()
        ));
    }

Stack trace:

    #0 [internal function]: Illuminate\Exception\Handler->handleError(2, 'Parameter 1 to ...', '/var/www/larave...', 59, Array)
    #1 /var/www/laravel/vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Collection.php(59): call_user_func_array(Array, Array)
    #2 /var/www/laravel/vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Query/Builder.php(408): Jenssegers\Mongodb\Collection->__call('insert', Array)
    #3 /var/www/laravel/vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Query/Builder.php(408): Jenssegers\Mongodb\Collection->insert(Array)
    #4 [internal function]: Jenssegers\Mongodb\Query\Builder->insertGetId(Array, '_id')
    #5 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(972): call_user_func_array(Array, Array)
    #6 /var/www/laravel/vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Eloquent/Builder.php(77): Illuminate\Database\Eloquent\Builder->__call('insertGetId', Array)
    #7 /var/www/laravel/vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Eloquent/Builder.php(77): Illuminate\Database\Eloquent\Builder->insertGetId(Array, '_id')
    #8 /var/www/laravel/bootstrap/compiled.php(6853): Jenssegers\Mongodb\Eloquent\Builder->insertGetId(Array, '_id')
    #9 /var/www/laravel/bootstrap/compiled.php(6843): Illuminate\Database\Eloquent\Model->insertAndSetId(Object(Jenssegers\Mongodb\Eloquent\Builder), Array)
    #10 /var/www/laravel/bootstrap/compiled.php(6800): Illuminate\Database\Eloquent\Model->performInsert(Object(Jenssegers\Mongodb\Eloquent\Builder))
    #11 /var/www/laravel/app/controllers/HomeController.php(79): Illuminate\Database\Eloquent\Model->save()
    #12 [internal function]: HomeController->thankYou('55c3c747ec2d2f9...')
    #13 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(231): call_user_func_array(Array, Array)
    #14 /var/www/laravel/bootstrap/compiled.php(5799): Illuminate\Routing\Controller->callAction('thankYou', Array)
    #15 /var/www/laravel/bootstrap/compiled.php(5787): Illuminate\Routing\ControllerDispatcher->call(Object(HomeController), Object(Illuminate\Routing\Route), 'thankYou')
    #16 /var/www/laravel/bootstrap/compiled.php(4986): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'HomeController', 'thankYou')
    #17 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}('55c3c747ec2d2f9...')
    #18 /var/www/laravel/bootstrap/compiled.php(5345): call_user_func_array(Object(Closure), Array)
    #19 /var/www/laravel/bootstrap/compiled.php(5011): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
    #20 /var/www/laravel/bootstrap/compiled.php(4999): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
    #21 /var/www/laravel/bootstrap/compiled.php(722): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
    #22 /var/www/laravel/bootstrap/compiled.php(703): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
    #23 /var/www/laravel/vendor/barryvdh/laravel-debugbar/src/Middleware/Stack.php(34): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
    #24 /var/www/laravel/bootstrap/compiled.php(7763): Barryvdh\Debugbar\Middleware\Stack->handle(Object(Illuminate\Http\Request), 1, true)
    #25 /var/www/laravel/bootstrap/compiled.php(8370): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
    #26 /var/www/laravel/bootstrap/compiled.php(8317): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
    #27 /var/www/laravel/bootstrap/compiled.php(10974): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
    #28 /var/www/laravel/bootstrap/compiled.php(664): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
    #29 /var/www/laravel/public/index.php(49): Illuminate\Foundation\Application->run()
    #30 {main} [] []
@fuzeboxsoftware
Copy link
Author

Using laravel 4.2 and have "jenssegers/mongodb": "2.0.*" set to match laravel version.

This code was working before but had to reinstall the server setup. Not sure if I am missing a configuration on mongo (which I am new to) or what.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants