This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » support » General discussion » problem withYAML
problem withYAML [message #97329] Wed, 14 April 2010 11:07
jaimetraba  is currently offline jaimetraba
Messages: 1
Registered: April 2010
Junior Member
Hello everybody,

I´m new in the forum and new in Symfony and PHP.



I want to get some data from the database using Criteria and then put that data in a YAML file. This is my code:

************************************************************ ***

$c = new Criteria();
$proveedores = ProveedorPeer::doSelect($c);

for( $i = 0; $i < count($proveedores); $i ++)
{
$arrayObjetos[$i] = array(
'Proveedor_'.$proveedores[$i]->getId() => '' ,
'nombre' => $proveedores[$i]->getNombre(),
'datosFiscales' => $proveedores[$i]->getDatosFiscales(),
'codProveedor' =>$proveedores[$i]->getCodProveedor(),
'datosEnvio' => $proveedores[$i]->getDatosEnvio(),
'idEditran' => $proveedores[$i]->getIdEditran(),
);
}

$dumper = new sfYamlDumper();
$yaml = $dumper->dump($arrayObjetos,2);
file_put_contents('/var/desarrolloGia/proveedores.yml',$yaml );

************************************************************ ****

And this is what I get in proveedores.yml file

-
Proveedor_1: ''
nombre: sanitas
datosFiscales: '572067'
codProveedor: '113710'
datosEnvio: null
idEditran: sanitas
-
Proveedor_2: ''
nombre: adeslas
datosFiscales: '522075'
codProveedor: '501510'
datosEnvio: null
idEditran: adeslas


But that is wrong, what I need to get in proveedores.yml file is this:

Proveedor:
Proveedor_1:
nombre: sanitas
datos_fiscales: 572067
cod_proveedor: 113710
datos_envio: null
id_editran: sanitas
Proveedor_2:
nombre: adeslas
datos_fiscales: 522075
cod_proveedor: 501510
datos_envio: null
id_editran: adeslas


Can anyone tell me what do I have to change in my code to get the proveedores.yml file like I need?


Thanks a lot.

Jaime

[Updated on: Wed, 14 April 2010 11:08]

Previous Topic:database design problem
Next Topic:increse video upload size
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software