i have this schema below, i have generated the classes using symfony and created a pair of objects using the form class generated.
moto:
marca: { type: varchar(255), required: true }
matricula: { type: integer, required: true }
Now i have this criteria:
$c = new Criteria();
$c->addSelectColumn('MAX('.MotoPeer::MATRICULA.')');
$max_matricula = MotoPeer::doSelect($c);
var_dump($max_matricula);
return $max_matricula;
When i call the criteria code It works ok, but these three notices below are showed.
Any idea?
sf 1.4/propel 1.4
( ! ) Notice: Undefined offset: 2 in /opt/lampp/htdocs/prueba/lib/ model/om/BaseMotoPeer.php on line 379 Call Stack
Time Memory Function Location 1 0.0008 328076
{main}( ) ../frontend_dev.php:0 2 0.1974 4333236 sfContext->dispatch( )
../frontend_dev.php:13 3 0.1974 4333264 sfFrontWebController->dispatch( )
../ sfContext.class.php:170 4
0.1981 4350256 sfController->forward( ) ../ sfFrontWebController.class.php:48 5
0.2134 4641000 sfFilterChain->execute( )
../sfController.class.php: 238 6
0.2138 4641808 sfRenderingFilter->execute( )
../ sfFilterChain.class.php:53 7
0.2138 4641808 sfFilterChain->execute( ) ../ sfRenderingFilter.class.php:33 8
0.2143 4642588 sfExecutionFilter->execute( )
../ 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.2493 5756568 BaseMotoPeer::getPrimaryKeyHashFromRow( ) ../ BaseMotoPeer.php:400( ! ) Notice: Undefined offset: 1 in /opt/lampp/htdocs/prueba/lib/ model/om/BaseMoto.php on line 184 Call Stack
Time Memory Function Location 1 0.0008 328076
{main}( ) ../frontend_dev.php:0 2 0.1974 4333236 sfContext->dispatch( )
../frontend_dev.php:13 3 0.1974 4333264 sfFrontWebController->dispatch( )
../ sfContext.class.php:170 4
0.1981 4350256 sfController->forward( ) ../ sfFrontWebController.class.php:48 5
0.2134 4641000 sfFilterChain->execute( )
../sfController.class.php: 238 6
0.2138 4641808 sfRenderingFilter->execute( )
../ sfFilterChain.class.php:53 7
0.2138 4641808 sfFilterChain->execute( ) ../ sfRenderingFilter.class.php:33 8
0.2143 4642588 sfExecutionFilter->execute( )
../ 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->hydrate( ) ../BaseMotoPeer.php:408( ! ) Notice: Undefined offset: 2 in /opt/lampp/htdocs/prueba/lib/ model/om/BaseMoto.php on line 185 Call Stack
Time Memory Function Location 1 0.0008 328076
{main}( ) ../frontend_dev.php:0 2 0.1974 4333236 sfContext->dispatch( )
../frontend_dev.php:13 3 0.1974 4333264 sfFrontWebController->dispatch( )
../ sfContext.class.php:170 4
0.1981 4350256 sfController->forward( ) ../ sfFrontWebController.class.php:48 5
0.2134 4641000 sfFilterChain->execute( )
../sfController.class.php: 238 6
0.2138 4641808 sfRenderingFilter->execute( )
../ sfFilterChain.class.php:53 7
0.2138 4641808 sfFilterChain->execute( ) ../ sfRenderingFilter.class.php:33 8
0.2143 4642588 sfExecutionFilter->execute( )
../ 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->hydrate( ) ../BaseMotoPeer.php:408
EDIT: the first notice appears because i didn't write "id: ~" before the fields of the model. Here it goes the lines that causes the second and the third notices:
/**
* 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
I think, the second and the third notices are showed because in the criteria I'm just getting one column (maatricula). But how to do it so?
Javier