In EC-CUBE 3.0.10, we have customized the order number and set it randomly, so we need to check the duplicate order number that already exists.
First, I created the following SQL and created it in QueryBuilder.
·Created SQL
SELECT COUNT(o.order_number)
FROM dtb_ordero
WHEREo.order_number = Combined Order Number
·Create with QueryBuilder
$qb=$em->getRepository('Eccube\Entity\Order')
->createQueryBuilder('o')
->select('COUNT(o.order_number)')
->where('o.order_number=:orderId')
->setParameter('orderId','$orderId');
$countOrderId = $qb
->getQuery()
->getSingleResult();
At this time, an error occurred due to insufficient memory, so we decided to change it to the following SQL.
·Recreated SQL
SELECT1
FROM dtb_ordero
WHEREo.order_number = Combined Order Number
LIMIT1
In this case, how to describe it in QueryBuilder
Please let me know if anyone knows.
It doesn't matter if it's a hint.
Thank you for your cooperation.
Hereafter, add
·Error contents
Apache error logs are as follows:
Do you feel like you don't have enough memory?
[Thu Jun 30 13:51:01.710082 2016] [:error] [pid9568:tid1856] [client::1:61415] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 552 bytes) in C:\xampp\htdocs\eccube-3.0.10\vendorOS\diverLibline\Dobline\Dobline\Dobline\Dobline\Dobline\Dobline\Dobacalhost/eccube-3.0.10/html/index_dev.php/cart
Out of memory error.
EC-CUBE3 is impossible with memory_limit 256MB, so I think it would be better to increase it with php.ini or ini_set().
Also, if the purpose is to check duplication,
$Order=$em->getRepository('Eccube\Entity\Order')
->findOneBy(array('order_number'=>$orderId));
So, I think it's okay to check if $Order is null.
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
582 PHP ssh2_scp_send fails to send files as intended
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
619 Uncaught (inpromise) Error on Electron: An object could not be cloned
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.