我有实体Country和City与OneToManyfromCountry和ManyToOnefrom的关系City,如下所示:
Country.php 
<?php
namespace models;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo,
    Doctrine\Common\Collections\ArrayCollection;
/**
 * @ORM\Entity(repositoryClass="models\repository\CountryRepository")
 * @ORM\Table(name="Country")
 *
 */
class Country{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue
     */
    private $id;
    /**
     * @ORM\Column(type="string", length=255, nullable=false)
     */
    private $name;
    /**
     * @var datetime $created
     *
     * @Gedmo\Timestampable(on="create")
     * @ORM\Column(type="datetime")
     */
    private $created;
    /**
     * @ORM\OneToMany(targetEntity="models\City",mappedBy="country")
     */
    private $cities;
    //getters and setters 
}
City.php
    
class City{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue
     */
    private $id;
   /**
     * @ORM\ManyToOne(targetEntity="models\Country")
     */
    private $country;
    /**
     * @ORM\Column(type="string", length=255, nullable=false)
     */
    private $name;
    //getters and setters
}
当我尝试使用cityId(比如1)获取一个城市时,
$city_ = $this->doctrine->em->find('models\City', 1);
我得到的错误是
Fatal error: require(): Failed opening required 'application/models/proxies/__CG__modelsCountry.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/MyCIApp/application/third_party/Doctrine/ORM/Proxy/ProxyFactory.php on line 93 
第 93 行可以在学说 2 (github)上查看
笔记:
1 - 我/etc/php5/apache2/php.ini是
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; UNIX: "/path1:/path2"
;include_path = ".:/usr/share/php"
;
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"
;
; PHP's default setting for include_path is ".;/path/to/php/pear"
; http://php.net/include-path
;include_path=".:/usr/share/php/pear"
; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues.  The alternate is to use the
; cgi.force_redirect configuration below
; http://php.net/doc-root
2 - 当我获取与任何其他实体没有关系的实体时,例如
class Sector{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue
     */
    private $id;
    /**
     * @ORM\Column(type="string", length=255, nullable=false)
     */
    private $description;
}
它运作良好
$sector = $this->doctrine->em->find('models\Sector', 1);