Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/11/2014, 14:17
Avatar de Dundee
Dundee
 
Fecha de Ingreso: junio-2002
Ubicación: El Médano
Mensajes: 1.310
Antigüedad: 21 años, 10 meses
Puntos: 8
Warning: spl_object_hash() expects parameter 1 to be object, integer given in /var/ww

Buenas, ahora que he conseguido crear los setters y getters y parece que mi relación One-To-One, Self-referencing está correcta, al crear el controlador index , me sale este error que no entiendo.

Código:
Warning: spl_object_hash() expects parameter 1 to be object, integer given in /var/ww
El código es muy sencillito ,estoy solo testeando por ahora.

Código:
<?php

namespace Book\MainBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Book\MainBundle\Entity\Book;

class DefaultController extends Controller
{
    public function indexAction($book)
    {
      
        $book = new Book();
       
        $book->setPhrase('Continua...');
        $book->setParentBranch(1);
        $book->setCreatorUid(1);
         var_dump($book);
        $em = $this->getDoctrine()->getManager();
        $em->persist($book);
        $em->flush();
        
        return $this->render('BookMainBundle:Default:index.html.twig', array('book' => $book));
    }
}
Por cierto, al layout index.html.twig llegan los datos correctamente , por lo que no entiendo el error.

Un saludo y gracias de antemano.
__________________
Videotutoriales de Drupal