title: Runtime Notice: Accessing static property Proxies\__CG__\SimpleMediaBundle\Entity\Media::$lazyPropertiesDefaults as non static
body: <p>I created a custom bundle called <strong>SimpleMedia</strong>.  When I try to load a page that loads a company it gives me the Runtime Notice</p>
  
  <blockquote>
    <p>Runtime Notice: Accessing static property Proxies__CG__\SimpleMediaBundle\Entity\Media::$lazyPropertiesDefaults as non static.</p>
  </blockquote>
  
  <p>I know it has something to do with my one to one relation</p>
  
  <pre><code>(logoFile(Company Entity) -&gt; id (Media Entity).
  </code></pre>
  
  <p>Anyone have any ideas? I am using <strong>Symfony 2.7</strong></p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>  /**
     * @Route("/{id}", name="api_company_show")
     * @Method("GET")
     * @param $id
     * @return Response $response
     */
    public function showAction($id) {
      $company = $this-&gt;findCompanyById($id);
  
      $response = $this-&gt;createApiResponse($company, 200);
      return $response;
    }
  
    /**
     * Find company by id. Throw exception if it does not.
     * @param $id
     * @return Company $company
     */
    private function findCompanyById($id) {
      $company = $this-&gt;getDoctrine()
        -&gt;getRepository('AppBundle:Company')
        -&gt;find($id);
  
      if (!$company) {
        throw $this-&gt;createNotFoundException(sprintf(
          'No company found with id "%d"',
          $id
        ));
      }
  
      return $company;
    }
  </code></pre>
  
  <p><strong>Company.php</strong></p>
  
  <pre><code>  namespace AppBundle\Entity;
  
    use Doctrine\ORM\Mapping as ORM;
    use Doctrine\Common\Collections\ArrayCollection;
    use AppBundle\Entity\User;
    use Symfony\Component\HttpFoundation\File\File;
    use SimpleMediaBundle\Entity\Media;
  
    /**
     * Company
     * @ORM\Table()
     * @ORM\Entity(repositoryClass="AppBundle\Repository\CompanyRepository")
     */
    class Company
    {
      /**
       * @var integer
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var string
       * @ORM\Column(name="name", type="string", length=255)
       */
      private $name;
  
      /**
       * @var string
       * @ORM\Column(name="website", type="string", length=255, nullable=true)
       */
      private $website;
  
      /**
       * @var string
       * @ORM\Column(name="address_1", type="string", length=255, nullable=true)
       */
      private $address1;
  
      /**
       * @var string
       * @ORM\Column(name="address_2", type="string", length=255, nullable=true)
       */
      private $address2;
  
      /**
       * @var string
       * @ORM\Column(name="city", type="string", length=255, nullable=true)
       */
      private $city;
  
      /**
       * @var string
       * @ORM\Column(name="state", type="string", length=255, nullable=true)
       */
      private $state;
  
      /**
       * @var string
       * @ORM\Column(name="zipcode", type="string", length=50, nullable=true)
       */
      private $zipcode;
  
      /**
       * @var string
       * @ORM\Column(name="country", type="string", length=255, nullable=true)
       */
      private $country;
  
      /**
       * @var string
       * @ORM\Column(name="phone", type="string", length=50,  nullable=true)
       */
      private $phone;
  
      /**
       * @var string
       * @ORM\Column(name="fax", type="string", length=50,  nullable=true)
       */
      private $fax;
  
      /**
       * @var integer
       * @ORM\Column(name="years_in_business", type="integer", length=50,  nullable=true)
       */
      private $yearsInBusiness;
  
      /**
       * @var string
       * @ORM\Column(name="number_of_employees", type="integer", length=50,  nullable=true)
       */
      private $numberOfEmployees;
  
      /**
       * @var integer
       * @ORM\ManyToMany(targetEntity="AppBundle\Entity\User")
       */
      private $owners;
  
      /**
       * @ORM\OneToOne(targetEntity="SimpleMediaBundle\Entity\Media", cascade={"persist", "remove"}, orphanRemoval=true)
       * @ORM\JoinColumns({
       * @ORM\JoinColumn(name="logo_file", referencedColumnName="id", nullable=true)
       * })
       */
      protected $logoFile;
  
      /**
       * @ORM\Column(type="datetime", name="updated", nullable=true)
       * @var \DateTime $updated
       */
      protected $updated;
  
  
      public function __construct()
      {
        $this-&gt;owners = new ArrayCollection();
        $this-&gt;logoFile = new ArrayCollection();
      }
  
      /**
       * Get id
       * @return integer
       */
      public function getId()
      {
        return $this-&gt;id;
      }
  
      // Basic Getter and Setters
  
      /**
       * Set logo file id.
       * @param Media $media
       * @return $this
       */
      public function setLogoFile(Media $media)
      {
        $this-&gt;logoFile = $media;
  
        return $this;
      }
  
      /**
       * Get Log File.
       * @return File
       */
      public function getLogoFile()
      {
        return $this-&gt;logoFile;
      }
  
    }
  </code></pre>
  
  <p><strong>Media.php</strong></p>
  
  <pre><code>namespace SimpleMediaBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use SimpleMediaBundle\Entity\MediaInterface;
  
  /**
   * @ORM\Table()
   * @ORM\Entity(repositoryClass="SimpleMediaBundle\Repository\MediaRepository")
   */
  class Media implements MediaInterface
  {
    /**
     * @var integer $id
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;
  
    /**
     * @var string $name
     * @ORM\Column(name="name", type="string", length=255)
     */
    private $name;
  
    /**
     * @var string $path
     * @ORM\Column(name="path", type="string", length=500)
     */
    private $path;
  
    /**
     * @var string $size
     * @ORM\Column(name="size", type="integer", nullable=true)
     */
    private $size;
  
    /**
     * @var string $createdAt
     * @ORM\Column(name="created_at", type="datetime")
     */
    private $createdAt;
  
    /**
     * @var string $createdAt
     * @ORM\Column(name="updated_at", type="datetime")
     */
    private $updatedAt;
  
    /**
     * @var string $contentType
     * @ORM\Column(name="content_type", type="string", length=50, nullable=true)
     */
    private $contentType;
  
    /**
     * @var string $type
     * @ORM\Column(name="type", type="string", length=255)
     */
    private $type;
  
    public function __construct()
    {
      $this-&gt;createdAt = new \DateTime();
      $this-&gt;updatedAt = new \DateTime();
    }
  
    /**
     * Get id
     * @return integer
     */
    public function getId()
    {
      return $this-&gt;id;
    }
  
    // Basic Getter and Setters
  
    /**
     * Transform to string
     * @return string
     */
    public function __toString()
    {
      return (string) $this-&gt;getId();
    }
  
  }
  </code></pre>