在我使用 Doctrine 的 Web 应用程序中,我突然收到如下错误:
致命错误:第 53 行 {path_to_doctrine}/Doctrine/DBAL/Types/DateTimeType.php 中允许的内存大小为 134217728 字节已用尽(尝试分配 72 字节)
我之前没有出现。此外,仅供参考,面临此问题的部分有数千个数据行,并且确实与其他实体有关系。我只是无法理解它可能是什么内存问题。
另一个有趣的事情是,错误并非总是从“DateTimeType.php”抛出,我确实在“UnitOfwork.php”和其他一些文件中得到了它。
有人可以帮我解决这个错误吗?
我的环境是:Ubuntu、Amazon EC2 微实例、RDS 数据库服务器、PHP 5.3。
Code For data retrieval:
/**
* Return list of recors according to given start index and length
* @param type $start the start index number for the city list
* @param type $length Determines how many records to fetch
* @return type
*/
function get_by_range($start=1,$length=10,$criteria = array(),$orderBy = NULL)
{
try
{
return $this->em->getRepository($this->entity)->findBy($criteria, $orderBy, $length, $start);
}
catch(Exception $err)
{
log_message("error", $err->getMessage(), false);
print_r($err->getMessage());exit();
return NULL;
}
}
它被调用来填充主列表:
$this->data["joblist"] = $this->jobmodel->get_by_range((($page-1)*$pagingConfig['per_page']),$pagingConfig['per_page'],array("site"=> "test"), array('postTime' => 'DESC'));
实体类:
use Doctrine\ORM\Mapping as ORM;
/**
* PdJobs
*
* @Table(name="pd_jobs")
* @Entity
*/
class PdJobs
{
/**
* @var integer $id
*
* @Column(name="id", type="bigint", nullable=false)
* @Id
* @GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string $projectId
*
* @Column(name="project_id", type="string", nullable=false, unique=true)
*/
private $projectId;
/**
* @var string $title
*
* @Column(name="title", type="string", length=255, nullable=false)
*/
private $title;
/**
* @var string $url
*
* @Column(name="url", type="string", length=255, nullable=false)
*/
private $url;
/**
* @var string $shortDescription
*
* @Column(name="short_description", type="string", length=255, nullable=false)
*/
private $shortDescription;
/**
* @var string $site
*
* @Column(name="site", type="string", length=255, nullable=false)
*/
private $site;
/**
* @var datetime $postTime
*
* @Column(name="post_time", type="datetime", nullable=false)
*/
private $postTime;
/**
* @var \Doctrine\Common\Collections\ArrayCollection
* @ManyToMany(targetEntity="PdExpertises", inversedBy="jobs", fetch="EXTRA_LAZY")
* @JoinTable(name="pd_jobs_expertises")
*/
private $expertises;
/**
* @var string $type
*
* @Column(name="type", type="string", nullable=true)
*/
private $type;
/**
* @var string $description
*
* @Column(name="description", type="string", length=1000, nullable=true)
*/
private $description;
/**
* @var string $budget
*
* @Column(name="budget", type="string", length=255, nullable=true)
*/
private $budget;
/**
* @var string $skill
*
* @Column(name="skill", type="string", length=255, nullable=true)
*/
private $skill;
/**
* @var integer $candidates
*
* @Column(name="candidates", type="integer", options={"default":0},nullable=true)
*/
private $candidates;
/**
* @var string $averageAmount
*
* @Column(name="average_amount", type="string", length=255, nullable=true)
*/
private $averageAmount;
/**
* @var datetime $startDate
*
* @Column(name="start_date", type="date", nullable=true)
*/
private $startDate;
/**
* @var datetime $endDate
*
* @Column(name="end_date", type="date", nullable=true)
*/
private $endDate;
/**
* @var string $category
*
* @Column(name="category", type="string", length=255, nullable=true)
*/
private $category;/**
* @var string $subCategory
*
* @Column(name="sub_category", type="string", length=255, nullable=true)
*/
private $subCategory;
/**
* @var string $clientCountry
*
* @Column(name="client_country", type="string", length=255, nullable=true)
*/
private $clientCountry;
/**
* @var string $clientRating
*
* @Column(name="client_rating", type="string", length=255, nullable=true)
*/
private $clientRating;
每页最多检索 25 行。所以我在想可能不是问题吗?在外键关系的情况下,我还有“fetch="EXTRA_LAZY"。所以,我希望那部分也安全吗?
但是,我在想另一点,我的主键列 'id' 的类型是 'integer' ,这可能是问题吗?但是,错误并没有具体指向此错误。另外,澄清一下,我总共有大约 30k 数据。