public function showJSONAction()
 {
     $persona = Persona::get($this->params['id']);
     YuppLoader::load('core.persistent.serialize', 'JSONPO');
     return $this->renderString(JSONPO::toJSON($persona, true));
     //return $this->renderString( $persona->toXML(true) );
 }
コード例 #2
0
 public function test1()
 {
     $mano = new Mano(array("tamanio" => "grande", "dedos" => array(new Dedo(array("uniaLarga" => true)), new Dedo(array("uniaLarga" => true)), new Dedo(array("uniaLarga" => false)))));
     $dedos = $mano->getDedos();
     foreach ($dedos as $dedo) {
         $dedo->setMano($mano);
     }
     //Logger::getInstance()->on();
     $this->assert($mano->save(), 'TestCaseM003: Test salvar mano y dedos ' . print_r($mano->getErrors(), true), array('mano' => print_r($mano, true)));
     //Logger::getInstance()->off();
     // Debe fallar el save porque hay datos erroneos
     $this->assert(true, 'TestCaseM003: Test generar XML ' . print_r(XMLPO::toXML($mano, true, true), true));
     $this->assert(true, 'TestCaseM003: Test generar JSON ' . print_r(JSONPO::toJSON($mano, true), true));
 }