当我处理一批数据库操作时,我收到错误:
致命错误:第661行\ vendor \ doctrine \ orm \ lib \ Doctrine \ ORM \ UnitOfWork.php超出最长执行时间120秒
它怎么样?每次我创建或更新实体时,我都会坚持并刷新。 如何检查执行的原因是什么,为什么一些批处理实体需要120秒才能执行并停止脚本?
$timezone = 'Europe/London';
$currency = 'EUR';
//get all apparments and set the price for them for different dates
$entAll = $this->em
->getRepository( 'BookBundle\Entity\App' )
->findBy( [],['aliasApp' => 'ASC'] );
if( $entAll!==null ) {
foreach ( $entAll as $ent ) {
$aliasApp = $ent->getAliasApp();
for ( $m=1; $m<=12; $m++ ) {
for ( $d=1; $d<=31; $d++ ) {
for ( $y=2019; $y<=2020; $y++ ) {
$isvalid = checkdate($m,$d,$y); //m, d, y
if($isvalid) {
$aliasAppPr = $aliasApp.'_'.$d.'_'.$m.'_'.$y;
$curD = new \DateTime( $y.'-'.$m.'-'.$d, new \DateTimeZone($timezone) );
$curts = $curD->getTimestamp();
$acp = new AppCalPr();
$acp->setAliasAppPr( $aliasAppPr);
$acp->setDateAppPrStr( $d.'-'.$m.'-'.$y.' '.$timezone );
$acp->setDateAppPrInt( $curts);
if( $m>4 || $m<11 ) { $acp->setIsAppPrActive(1); }
else { $acp->setIsAppPrActive(0); }
if( $d<10 || $d>20 ) { $acp->setIsAppPrBooked(1); }
else { $acp->setIsAppPrBooked(0); }
$price = rand(30,300);
$acp->setPriceAppPr($price);
$acp->setCurrAppPr($currency);
$this->em->persist($acp);
$this->em->flush();
//single day = single price setting, single booking, single appartment
print_r( '<br><br> 88 AppCalPrFix, aliasAppPr=' .$aliasAppPr );
$acbEnt = $this->em
->getRepository( 'BookBundle\Entity\AppCalBookRel' )
//->findBy( [],['aliasApp' => 'ASC'] );
->findOneByAliasAppPrACB( $aliasAppPr );
if ( $acbEnt== null) {
$acbEnt =new AppCalBookRel();
$acbEnt->setAppcalOTO($acp);
$acbEnt->setAliasAppPrACB($aliasAppPr);
$this->em->persist($acbEnt);
$this->em->flush();
}
} //if($isvalid) {
} // for ( $y=2019; $y<2025; $y++ ){
} // for ( $d=1; $d<=31; $d++ ) {
} // for ( $m=4; $m<10; $m++ ) {
}// foreach ( $entAll as $ent ) {
} // if( $entAll!==null ) {