When i tried to read from an rss file to import into symfony i got an error
Fatal error: Call to undefined method SimpleXMLElement::__toString() in ....lib/symfony/plugins/sfPropelPlugin/lib/vendor/creole/common/PreparedStatementCommon.php on line 596
While for printing out a string readen by SimpleXML is jost okay, for Symfony it is not.
$rsscontent=
file_get_contents($rssfeed);
$rssfile=simplexml_load_string
($rsscontent);
foreach($rssfile->
channel->
item as $rssitem){ $c =
new Criteria
();
$strName=
$rssitem->
name;
$c->
add(ProcuctPeer::
Name,
$strName);
$objProduct=ProductPeer::
doSelect($c);
For normal output it is just okay to write.
echo "<h1>".
$rssitem->
name.
"</h1>";
It works fine.
The solution is to convert the value to a real string.
$strName=(string)$rssitem->name;
For setting values also the simplexml object of type string works.
$objProduct->setName($rssitem->name)