segunda-feira, 25 de janeiro de 2016

Error: SQLSTATE[HY000]: General error: 1364 Field 'parent_id' doesn't have a default value

CakePHP Cookbook Documentation
Release 3.x
Cake Software Foundation

January 18, 2016

Page 88

These fields are automatically managed by the TreeBehavior when a category is saved.
Using your web browser, add some new categories using the /yoursite/categories/add controller

action.

Error: SQLSTATE[HY000]: General error: 1364 Field 'parent_id' doesn't have a default value

If you are using SQL keywords as table column names, you can enable identifier quoting for your database connection in config/app.php.

SQL Query:

INSERT INTO categories (lft, rght) VALUES (:c0, :c1)
If you want to customize this error message, create src\Template\Error\pdo_error.ct

SOLUTION

The parent_id was created as not null, make it nullable.

I did it using PHP Admin
I'm using vertrigo (the best wamp I ever found)




2 comentários: