我将Doctrine与Codeigniter一起使用,我将我的评级列定义为$this->hasColumn(' ratings ','array',1000);。我正在使用
$res = Doctrine::getTable('Resource')->find($resource\_id); $res->ratings = $rating; $res->save(); but only the $rating gets inserted, overwriting the last value, I want to store the ratings as an array, ex: 1,5,4,2,3,5,1 etc.. How do I add/retrieve values from a table column defined as array with Doctrine? (I'm using mysql)发布于 2010-06-19 16:43:16
我不熟悉CodeIgniter,但是因为Doctrine“数组”类型等同于MySQL文本类型,所以在PHP中,我会使用implode()和explode()函数来创建一个以逗号分隔的值字符串,并将其存储为文本字符串。MySQL VARCHAR可能更适合您的需要。Doctrine的等价物是"string“。
希望这能有所帮助。
https://stackoverflow.com/questions/3070606
复制相似问题