我有這個模式如下,我已經生成了使用symfony 的類,並使用生成的表單類創建了一對對象。條件:「未定義的偏移」
moto:
marca: { type: varchar(255), required: true }
matricula: { type: integer, required: true }
現在我有這樣的條件:
$c = new Criteria();
$c->addSelectColumn('MAX('.MotoPeer::MATRICULA.')');
$max_matricula = MotoPeer::doSelect($c);
var_dump($max_matricula);
return $max_matricula;
當我打電話的標準代碼,它工作正常,但是這三個通知如下 被顯示。
有什麼想法?
SF 1.4/1.4推進
通知(!):未定義抵消:2 的/ opt/LAMPP/htdocs中/ prueba/lib中/ 模型/ OM/BaseMotoPeer.php上線379 呼叫堆棧
時間記憶功能位置1 0.0008 328076
{主}()../frontend_dev.php:0 2 0.1974 4333236 sfContext->調度()
../frontend_dev.php:13 3 0.1974 sfFrontWebController->調度()
../ sfContext.class.php:170 4
0.1981 4350256 sfController->向前()../ sfFrontWebController.class .PHP:48 5
0.2134 4641000 sfFilterChain->執行()
../sfController.class.php:238 6
0.2138 4641808 sfRenderingFilter->執行()
../ sfFilterChain.class.php:53 7
0.2138 4641808 sfFilterChain-> execute()../ sfRenderingFilter.class.php:33 8
0.2143 4642588 sfExecutionFilter->執行()
../ sfFilterChain.class.php:53 9
0.2144 4643308 sfExecutionFilter-> handleAction()
../ sfExecutionFilter.class.php:42 10 0.2144 4643308 sfExecutionFilter - > executeAction() ../ sfExecutionFilter.class.php:78 11 0.2144 4643336 sfActions->執行()../sfExecutionFilter.class.php:92 12 0.2147 4644160 motoActions-> executePrueba()
.. /sfActions.class.php:60 13
0.2212 5026172 MotoPeer :: prueba()../actions.class.php:14 14 0.2254 528559 2個BaseMotoPeer ::的doSelect()
../MotoPeer.php:26 15 0.2493 5756176個BaseMotoPeer :: populateObjects( )../BaseMotoPeer.php:241個16
0.2493 5756568 BaseMotoPeer :: getPrimaryKeyHashFromRow( )../BaseMotoPeer.php:400(! )注意:未定義抵消:1 的/ opt/LAMPP/htdocs中/ prueba/lib中/ 模型/ OM/BaseMoto.php上線184呼叫 堆棧
時間記憶功能位置1 0。0008 328076
{主}()../frontend_dev.php:0 2 0.1974 4333236 sfContext->調度()
../frontend_dev.php:13 3 0.1974 sfFrontWebController->調度( )
../ sfContext.class.php:170 4
0.1981 4350256 sfController->向前()../ sfFrontWebController.class.php:48 5
0.2134 4641000 sfFilterChain->執行()
.. /sfController.class.php:238 6
0.2138 464 1808 sfRenderingFilter->執行()
../ sfFilterChain.class.php:53 7
0.2138 4641808 sfFilterChain->執行()../ sfRenderingFilter.class.php:33 8
0.2143 4642588 sfExecutionFilter->執行()
../ sfFilterChain.class.php:53 9
0.2144 4643308 sfExecutionFilter-> handleAction()
../ sfExecutionFilter.class.php:42 10 0.2144 4643308 sfExecutionFilter-> executeAction() ../sfExecutionFilter.class.php:78 11 0.2144 4643336 sfActions-> execute()../sfExecutionFilter.class.php:92 12 0.2147 4644160 motoActions-> executePrueba()
../sfActions.class.php:60 13
0.2212 5026172 MotoPeer :: prueba()../actions.class.php:14 14 0.2254 5285592 BaseMotoPeer ::的doSelect ()
../MotoPeer.php:26 15 0.2493 5756176個BaseMotoPeer :: populateObjects( )../BaseMotoPeer.php:241 16
0.2578 5953424 BaseMoto->水合物()../BaseMotoPeer.php:408(! )注意:未定義偏移:2 /選擇/ LAMPP/htdocs中/ prueba/LIB/ 模型/ OM/BaseMoto.php上線185呼叫 堆棧
時間記憶功能位置1 0.0008 328076
{主}()../frontend_dev.php:0 2 0.1974 4333236 sfContext->調度()
../frontend_dev.php:13 3 0.1974 sfFrontWebController->調度()
../ sfContext .class.php:170 4
0.1981 4350256 s fController->向前()../ sfFrontWebController.class.php:48 5
0.2134 4641000 sfFilterChain->執行()
../sfController.class.php:238 6
0.2138 4641808 sfRenderingFilter->執行( )
../ sfFilterChain.class.php:53 7
0.2138 4641808 sfFilterChain->執行()../ sfRenderingFilter.class.php:33 8
0.2143 4642588 sfExecutionFilter->執行()
../sfFilterChain.class.php:53 9
0.2144 4643308 sfExecutionFilter-> handleAction()
../ sfExecutionFilter.class.php:42 10 0.2144 4643308 sfExecutionFilter-> executeAction() ../ sfExecutionFilter.class.php:78 11 0.2144 4643336 sfActions->執行()../sfExecutionFilter.class.php:92 12 0.2147 4644160 motoActions-> executePrueba()
../sfActions.class.php:60 13
0.2212 5026172 MotoPeer :: prueba()../actions.class.php:14 14 0.2254 5285592 BaseMotoPeer ::的doSelect()
../MotoPeer.php:26 15 0.2493 5756176 BaseMotoPeer :: populateObjects( )../BaseMotoPeer.php:241 16
0.2578 5953424 BaseMoto->水合物()../BaseMotoPeer.php:408
編輯:第一通知出現,因爲我沒有寫在模型的字段之前的「id:〜」。這裏有雲導致第二和第三通知書行:
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
* An offset (0-based "start column") is specified so that objects can be hydrated
* with a subset of the columns in the resultset rows. This is needed, for example,
* for results of JOIN queries where the resultset row includes columns from two or
* more tables.
*
* @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
* @param int $startcol 0-based offset column which indicates which restultset column to start with.
* @param boolean $rehydrate Whether this object is being re-hydrated from the database.
* @return int next starting column
* @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
*/
public function hydrate($row, $startcol = 0, $rehydrate = false)
{
try {
var_dump($row);
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->marca = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;//184
$this->matricula = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;//185
我認爲,第二個和第三個聲明是因爲在我剛一列(maatricula)的標準顯示。但如何做到這一點?
哈維爾
張貼在通知中提到的行將有助於... – greg0ire 2011-01-09 17:01:24