vamp
(Vamphouse)
May 6, 2009, 3:37pm
1
Fatal error: Call to a member function prepare() on a non-object in ...frameworkdbCDbCommand.php on line 111
$db = Yii::app()->getDb();
$cmd = $db->createCommand('select 1');
$srz = serialize(Yii::app()->getDb());
$cmd->prepare(); // ERROR!!!!!!!!!!!!!!!!
qiang
(Qiang Xue)
May 6, 2009, 4:15pm
2
Why would you serialize db connection? When you do that, it will automatically disconnect the database and thus your command won't execute as expected.
vamp
(Vamphouse)
May 6, 2009, 4:17pm
3
I simply serialize state of my component, including dbConnection in it
qiang
(Qiang Xue)
May 6, 2009, 4:30pm
4
You should avoid serializing resources.