Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Getting 'Field 'id' doesn't have a default value' exception
  • I'm using Fuel and Auth 1.9dev and Php 8.1 and I've namespaced my models and controllers

    I'm using the example code from the auth examples.

    Edit user works just fine.

    I'm unable to get a new user to register, I've had a couple of issues.

    #1 \Config::get('application.user.registration', false) is ALWAYS returning false in spite of /config/application.php

    return [
    'user' => [
    'registration' => true
    ]
    ];
    #2 If I remove the registration check \Auth::create_user() fails and throws the exception "Field 'id' doesn't have a default value"

    I know the exception thrown because I altered auth\login\ormauth.php :

    291	        catch (\Exception $e)
    292 {
    293 throw new \SimpleUserUpdateException($e->GetMessage(), 99);
    294 $result = false;
    295 }
    So that I could pick up the message in my code
  • HarroHarro
    Accepted Answer
    I don't know, did you load the application config file first?

    And 'id''s in the database should always be "auto-increment". If not, you have to make sure you assign it a unique value yourself.
  • "I don't know, did you load the application config file first?"

    - No, I'm dumb!

    "And 'id''s in the database should always be "auto-increment". If not,
    you have to make sure you assign it a unique value yourself."

    - I checked the database and the id wasn't set to auto-increment, it was initially set that way by the auth migration but I'm gonna take a guess and say that when I migrated my development server I somehow lost it. I hadn't noticed it until now.

    Thanks again!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion