title: Symfony: How do I annotate entity properties that are objects to get Doctrine to store a foreign key?
body: <p>I'm still getting to grips with Symfony and Doctine and I appreciate this might sound overly simple.</p>
  
  <p>I have at present two basic entities: <code>WebSite</code> (having <code>id</code> and <code>canonicalUrl</code> properties) and <code>Job</code> which has, as one property, a <code>WebSite</code>.</p>
  
  <p>A <code>Job</code> has one <code>WebSite</code>; a <code>WebSite</code> can be referenced by many <code>Job</code>s. Both are under the same namespace. </p>
  
  <p>Relevant here is the <code>Job</code> entity:</p>
  
  <pre><code>/**
   * 
   * @ORM\Entity
   */
  class Job
  {
      /**
       * 
       * @var integer
       * 
       * @ORM\Id
       * @ORM\Column(type="integer")
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      protected $id;
  
      /**
       *
       * @var WebSite
       */
      protected $website;
  }
  </code></pre>
  
  <p>In database terms, a persisted <code>Job</code> should be storing the <code>id</code> of the relevant <code>WebSite</code>.</p>
  
  <p>Without any changes to the above, calling <code>php app/console doctrine:migrations:diff</code> generates a new migration for a table named <code>Job</code> with a single <code>id</code> field.</p>
  
  <p>How do I annotate <code>Job::website</code> such that Doctrine knows to create an integer field and to get the value as the <code>id</code> of the <code>Website</code> object?</p>