Re: [symfony-users] Building XML from models

2010-03-09 Thread Augusto Flavio
Hi Ashton,


i don't know what specifically  do you want but maybe this code help you:


class mymoduleActions extends sfActions
{

  public function executeXML(sfWebRequest $request)
  {
$this->rows = Doctrine::getTable('table')
  ->createQuery('a')
  ->execute();
  }
}


//template
formatOutput = true;

$noticias = $xmlDoc->createElement('items');
$noticias = $xmlDoc->appendChild($rows);


foreach ($rows as $row)
{
  $item = $xmlDoc->createElement('item');
  $item = $noticias->appendChild($item);

  $title = $xmlDoc->createElement('title',$tow->getName().' -
'.$row->getField());
  $title = $item->appendChild($title);
}
echo $xmlDoc->saveXML();

?>



Bye


Augusto Morais

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] Building XML from models

2010-03-09 Thread Gareth McCumskey
To be perfectly honest there really is no need to do this. You can
easily create a REST based API through your existing actions.

On Wed, Mar 10, 2010 at 1:54 AM, ashton honnecke  wrote:
> I'm putting together and API and I would like to be able to build XML
> objects of my model objects (similar to how forms work).  Has anyone
> done this before?  It seems to me that some custom formatting of the
> form objects would do this nicely, but I am interested to know how
> this has been solved before.
>
> ashton
>
> --
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Building XML from models

2010-03-09 Thread ashton honnecke
I'm putting together and API and I would like to be able to build XML
objects of my model objects (similar to how forms work).  Has anyone
done this before?  It seems to me that some custom formatting of the
form objects would do this nicely, but I am interested to know how
this has been solved before.

ashton

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en