title: Mapping doesn't work ORM
body: <p>I have this example:</p>
  
  <p>Log.php</p>
  
  <pre><code>    &lt;?php
  // src/Mailing/MailingBundle/Entity/Log.php
  
  namespace Mailing\MailingBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * @ORM\Entity
   * @ORM\Table(name="log")
  */
  
  class Log
  {
      /**
       * @ORM\Id
       * @ORM\Column(type="integer")
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      protected $id;
  
  
      /**
       * @ORM\Column(type="string", length=20)
       */
      protected $action;
  
      public function getAction() {
          return $this-&gt;action;
      }
  
      public function setAction($action) {
          $this-&gt;action = $action;
      }
  
      /**
       * @ORM\Column(type="datetime")
       */
      protected $date;
  
      public function getDate() {
          return $this-&gt;date;
      }
  
      public function setDate($date) {
          $this-&gt;date = $date;
      }
  
      /**
       * @ORM\Column(type="integer", name="mail_id")
       * @ORM\oneToOne(targetEntity="Mail")
       */
      protected $mail;
  
      public function getMail() {
          return $this-&gt;mail;
      }
  
      public function setMail($mail) {
          $this-&gt;mail = $mail;
      }
  
      /**
       * @ORM\Column(type="integer", name="template_id")
       * @ORM\oneToOne(targetEntity="Template")
       */
      protected $template;
  
      public function getTemplate() {
          return $this-&gt;template;
      }
  
      public function setTemplate($template) {
          $this-&gt;template = $template;
      }
  }
  </code></pre>
  
  <p>Mail.php</p>
  
  <pre><code>&lt;?php
  // src/Mailing/MailingBundle/Entity/Mail.php
  
  namespace Mailing\MailingBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * @ORM\Entity
   * @ORM\Table(name="mail")
  */
  
  class Mail
  {
      /**
       * @ORM\Id
       * @ORM\Column(type="integer")
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      protected $id;
  
      public function getId() {
          return $this-&gt;id;
      }
  
      /**
       * @ORM\Column(type="string", length=200)
       */
      protected $address;
  
      /**
       * 
       * @return type
       */
      public function getAddress() {
          return $this-&gt;address;
      }
  
      /**
       * 
       * @param \Mailing\MailingBundle\Entity\Mail $surname
       */
      public function setAddress($address)
      {
          $this-&gt;address = $address;
      }
  
      /**
       * @ORM\Column(type="string", length=200)
       */
      protected $name;
  
      /**
       * 
       * @return type
       */
      public function getName() {
          return $this-&gt;name;
      }
  
      /**
       * 
       * @param \Mailing\MailingBundle\Entity\Mail $surname
       */
      public function setName($name)
      {
          $this-&gt;name = $name;
      }
  
      /**
       * @ORM\Column(type="string", length=200)
       */
      protected $surname;
  
      /**
       * 
       * @return type
       */
      public function getSurname() {
          return $this-&gt;surname;
      }
  
      /**
       * 
       * @param \Mailing\MailingBundle\Entity\Mail $surname
       */
      public function setSurname($surname)
      {
          $this-&gt;surname = $surname;
      }
  
      /**
       * @ORM\Column(type="boolean")
       */
      protected $subscribed;
  
      /**
       * 
       * @return type
       */
      public function getSubscribed() {
          return $this-&gt;subscribed;
      }
  
      /**
       * 
       * @param \Mailing\MailingBundle\Entity\Mail $subscribed
       */
      public function setSubscribed($subscribed)
      {
          $this-&gt;subscribed = $subscribed;
      }
  
  
      /**
       * @ORM\manyToMany(targetEntity="Inventory", inversedBy="articles")
       * @ORM\joinTable(
       *     name="mail_inventory",
       *     joinColumns={
       *         @ORM\joinColumn(name="mail_id", referencedColumnName="id")
       *     },
       *     inverseJoinColumns={
       *         @ORM\joinColumn(name="iventory_id", referencedColumnName="id")
       *     }
       * )
       */
      protected $inventories;
  
      /**
       * @return DoctrineCommonCollectionsCollection;
       */
      public function getInventories()
      {
          return $this-&gt;inventories;
      }
  
      /**
       * @ORM\Column(type="string", length=128)
       */
      protected $hash;
  
      public function getHash() {
          return $this-&gt;hash;
      }
  
      public function setHash($hash) {
          $this-&gt;hash = $hash;
      }
  
  }
  </code></pre>
  
  <p>LogController.php</p>
  
  <pre><code>&lt;?php
  // src/Mailing/MailingBundle/Controller/LogController.php
  
  namespace Mailing\MailingBundle\Controller;
  
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  
  class LogController extends Controller
  {
      public function indexAction()
      {
          $em = $this-&gt;getDoctrine()-&gt;getManager();
          $records = $em-&gt;getRepository('MailingBundle:Log')-&gt;findAll();        
          return $this-&gt;render('MailingBundle:Log:index.html.twig', array('logs' =&gt;$records));
      }
  }
  </code></pre>
  
  <p>Template:</p>
  
  <pre><code>{# src/Mailing/MailingBundle/Resources/views/Log/index.html.twig #}
  {% extends 'MailingBundle::layout.html.twig' %}
  
  {% block title %}
      Log
  {% endblock %}
  
  {% block headline %}
      Log
  {% endblock %}
  
  {% block content %}
      {% if logs %}
      &lt;table&gt;
          &lt;tr&gt;&lt;th&gt;Date&lt;/th&gt;&lt;th&gt;E-mail&lt;/th&gt;&lt;th&gt;Template&lt;/th&gt;&lt;/tr&gt;
          {% for log in logs %}
                  &lt;tr&gt;&lt;td&gt;{{ log.date|date('H:i j.n.Y') }}&lt;/td&gt;&lt;td&gt;{{ log.action }}&lt;/td&gt;&lt;td&gt;{{ log.mail.address }}&lt;/td&gt;&lt;td&gt;{{ log.template.name }}&lt;/td&gt;&lt;/tr&gt;
          {% endfor %}
      &lt;/table&gt;
      {% else %}
          No records to show...
      {% endif %}
  {% endblock %}
  </code></pre>
  
  <p>It generates this error:</p>
  
  <p><code>Impossible to access an attribute ("address") on a integer variable ("1") in MailingBundle:Log:index.html.twig at line 17</code></p>
  
  <p>This is DB Schema</p>
  
  <pre><code>log
  id  int(11) NO  PRI NULL    auto_increment
  action  varchar(20) YES     NULL    
  date    datetime    YES     NULL    
  mail_id int(11) NO  MUL NULL    
  template_id int(11) YES MUL NULL
  
  mail
  Field   Type    Null    Key     Default     Extra   
  id  int(11) NO  PRI NULL    auto_increment
  address varchar(200)    NO      NULL    
  name    varchar(200)    YES     NULL    
  surname varchar(200)    YES     NULL    
  subscribed  tinyint(1)  YES     1   
  hash    varchar(128)    NO      NULL
  </code></pre>
  
  <p>Thank you for help.</p>