I just got a copy of Web Application Development with Yii and PHP 2nd edition.
I was so excited to try a new PHP framework.
I just read first 4 chapters of this book and here are some problem I met.
- The problem with the compatibility between Yii 1.1.12 and PHPUnit 3.7.10 (missing function ‘phpunit_autoload’)
Okie I got a solution in githup.
I know it is not author’s fault but I think it’s still worth mentioning in the book.
- In page 53, the code for DbTest.php contains a line:
But after that, the author wrote "Change the assertEquals(true) statement …".
So what exactly is the statement?
Okie, it’s just a typo.
- In the chapter 4, project CRUD here is the code for creating table tbl_project
$this->createTable('tbl_project', array( 'id' => 'pk', 'name' => 'string NOT NULL', 'description' => 'text NOT NULL', 'create_time' => 'datetime DEFAULT NULL', 'create_user_id' => 'int(11) DEFAULT NULL', 'update_time' => 'datetime DEFAULT NULL', 'update_user_id' => 'int(11) DEFAULT NULL', ), 'ENGINE=InnoDB');
Everything went smoothly until I tried to create a new project like the author suggested.
I entered only the name and description of new project(coz they are required) and left other fields blank.
Then I got a problem.
CDbCommand failed to execute the SQL statement: SQLSTATE: Invalid datetime format: 1292 Incorrect datetime value: '' for column 'create_time' at row 1. The SQL statement executed was: INSERT INTO `tbl_project` (`name`, `description`, `create_time`, `create_user_id`, `update_time`, `update_user_id`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5)
I think the problem is that the datetime should not be declared as DEFAULT NULL.
Maybe it should be "0000-00-00 00:00:00" or something like that.
Hope someone can help me.
Thanks in advance.