title: Catchable Fatal Error: Object of class could not be converted to string
body: <p>I have this Entity defined:</p>
  
  <pre><code>namespace CategoryBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use Gedmo\Mapping\Annotation as Gedmo;
  
  /**
   * @ORM\Entity
   * @ORM\Table(name="category")
   */
  class Category {
  
      /**
       * @ORM\Id
       * @ORM\Column(type="integer")
       * @ORM\GeneratedValue(strategy="AUTO")
       * 
       */
      protected $id;
  
      /**
       *
       * @ORM\Column(type="string", length=255, nullable=false)
       */
      protected $name;
  
      /**
       *
       * @ORM\Column(type="integer", nullable=true)
       */
      protected $parent;
  
      /**
       *
       * @ORM\Column(type="string", length=255, nullable=true)
       */
      protected $description;
  
      /**
       *
       * @ORM\Column(type="integer")
       */
      protected $age_limit;
  
      /**
       * @Gedmo\Timestampable(on="create")
       * @ORM\Column(name="created", type="datetime")
       */
      protected $created;
  
      /**
       * @Gedmo\Timestampable(on="update")
       * @ORM\Column(name="modified", type="datetime")
       */
      protected $modified;
  
      public function getId() {
          return $this-&gt;id;
      }
  
      public function setParent(Category $parent = null) {
          $this-&gt;parent = $parent;
      }
  
      public function getParent() {
          return $this-&gt;parent;
      }
  
      public function setName($name) {
          $this-&gt;name = $name;
      }
  
      public function getName() {
          return $this-&gt;name;
      }
  
      public function setDescription($description) {
          $this-&gt;description = $description;
      }
  
      public function getDescription() {
          return $this-&gt;description;
      }
  
      public function setAgeLimit($age_limit) {
          $this-&gt;age_limit = $age_limit;
      }
  
      public function getAgeLimit() {
          return $this-&gt;age_limit;
      }
  
      public function setCreated($created) {
          $this-&gt;created = $created;
      }
  
      public function getCreated() {
          return $this-&gt;created;
      }
  
      public function setModified($modified) {
          $this-&gt;modified = $modified;
      }
  
      public function getModified() {
          return $this-&gt;modified;
      }
  }
  </code></pre>
  
  <p>Then I have this method in my controller for handle form submission:</p>
  
  <pre><code>/**
   * Handle category creation
   *
   * @Route("/category/create", name="category_create")
   * @Method("POST")
   * @Template("CategoryBundle:Default:new.html.twig")
   */
  public function createAction(Request $request) {
      $entity = new Category();
      $form = $this-&gt;createForm(new CategoryType(), $entity);
      $form-&gt;handleRequest($request);
  
      if ($form-&gt;isValid()) {
          $em = $this-&gt;getDoctrine()-&gt;getManager();
          $em-&gt;persist($entity);
          $em-&gt;flush();
  
          return $this-&gt;redirect($this-&gt;generateUrl('category_list'));
      }
  
      return $this-&gt;render('CategoryBundle:Default:new.html.twig', array(
                  'entity' =&gt; $entity,
                  'form' =&gt; $form-&gt;createView(),
      ));
  }
  </code></pre>
  
  <p>And finally this is my <code>CategoryType.php</code>:</p>
  
  <pre><code>public function buildForm(FormBuilderInterface $builder, array $options) {
      $builder
              -&gt;add('parent', 'entity', array('class' =&gt; 'CategoryBundle:Category', 'property' =&gt; 'name', 'required' =&gt; false))
              -&gt;add('name')
              -&gt;add('description')
              -&gt;add('age_limit');
  }
  </code></pre>
  
  <p>When I try to save data I get this error:</p>
  
  <blockquote>
    <p>An exception occurred while executing 'INSERT INTO category (name,
    parent, description, age_limit, created, modified) VALUES (?, ?, ?, ?,
    ?, ?)' with params ["Cat2", {}, null, 2, "2013-08-06 09:58:03",
    "2013-08-06 09:58:03"]:</p>
    
    <p>Catchable Fatal Error: Object of class CategoryBundle\Entity\Category
    could not be converted to string in
    /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php
    line 138</p>
  </blockquote>
  
  <p>What I'm doing wrong? How do I access to the property in my method so I can save the value?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Based on suggestions made by @sybio, I rewrite my Entity so now I have this:</p>
  
  <pre><code>/**
   * @ManyToOne(targetEntity="Category")
   * @JoinColumn(name="parent", referencedColumnName="id")
   */
  protected $parent;
  </code></pre>
  
  <p>Is that right?</p>