Error Object of class sfOutputEscaperIteratorDecorator could not be converted to int

139 views
Skip to first unread message

pepe

unread,
Jun 10, 2009, 3:33:04 PM6/10/09
to symfony-es
Buenas tardes por favor me podrían ayudar con el error:

Object of class sfOutputEscaperIteratorDecorator could not be
converted to int

Tengo la siguiente accion:

public function executeValor(sfWebRequest $request)
{
$q = Doctrine_Query::create()
->select('f.frec_valor')
->from('CudiFrecuencia f, f.CudiIndicado i)//, i.CudiRegiindi r')//,
i.CudiFrecuencia f, i.CudiRegiindi r')
->where('f.frec_codigo = ?', $this->job = Doctrine::getTable
('CudiIndicado')-> find($request->getParameter('indi_codigo')));
$this->frecu = $q->fetchone();
}

En la plantilla:

<?php
echo $frecu;
echo gettype($frecu);

echo $f = (integer) $frecu;

echo gettype($f);
echo $f

?>

12object
Notice: Object of class sfOutputEscaperIteratorDecorator could not be
converted to int in C:\xampp\htdocs\cudid\apps\principal\modules
\control\templates\valorSuccess.php on line 5
1integer1


el valor de la variable es 12 tipo object, la quiero convertir a
integer, aparentemente se convierte pero me cambia el valor a 1.

Como puedo utilizar el valor devuelto de la consulta. O como puedo
convertirla.

Muchas Gracias.

Jose

pablodip

unread,
Jun 10, 2009, 5:54:56 PM6/10/09
to symfony-es

pepe

unread,
Jun 10, 2009, 10:09:51 PM6/10/09
to symfony-es
Gracias Pablo por contestar, hice el cambio y ahora me sale este
error:

Notice: Object of class CudiFrecuencia could not be converted to int
in C:\xampp\htdocs\cudid\apps\principal\modules\control\templates
\valorSuccess.php on line 3
1


jose

pepe

unread,
Jun 11, 2009, 9:52:43 PM6/11/09
to symfony-es
La consulta devuelve un valor de tipo object, este valor para ser
utilizado tiene que convertirse a integer lo hice asi:

$frecu = $frecu->__toString();
$frecu = intval($frecu);

http://stackoverflow.com/questions/583157/convert-object-to-integer-in-php


Espero pueda ayudarle a alguien.

Jose
Reply all
Reply to author
Forward
0 new messages