我正在尝试->find()使用doctrine/orm 2.5.1 进行简单的操作.
查询非常简单:
$this->get('order_repository')->find(10);
Run Code Online (Sandbox Code Playgroud)
但这会产生一个复杂的查询:
SELECT s0_.number AS number_0,s0_.state AS state_1,s0_.completed_at AS completed_at_2,s0_.items_total AS items_total_3,s0_.adjustments_total AS adjustment_total_4,s0_.total AS total_5,s0_.created_at AS created_at_6,s0_.updated_at AS updated_at_7,s0_ .deleted_at AS deleted_at_8,s0_.id AS id_9,s0_.expires_at AS expires_at_10,s1_.currency AS currency_11,s1_.checkout_state AS checkout_state_12,s1_.payment_state AS payment_state_13,s1_.shipping_state AS shipping_state_14,s2_.quantity AS quantity_15,s2_.unit_price AS unit_price_16,s2_.adjustments_total AS adjustment_total_17,s2_.total AS total_18,s2_.is_immutable AS is_immutable_19,s2_.id AS id_20,s1_.channel_id AS channel_id_21,s1_.shipping_address_id AS shipping_address_id_22,s1_.billing_address_id AS billing_address_id_23,s1_.customer_id AS customer_id_24 ,s1_.offer_id AS offer_id_25,s2_.order_id AS order_id_26,s2_.variant_id AS variant_id_27 FROM sylius_order s1_ LEFT JOIN sylius_order_item s2_ ON s1_.id = s2_.order_id WHERE(s1_.id …
我在使用Twig和Sf2制作表单时遇到了麻烦.
Unknown tag name "form_rest" in MyBundle:Default:home.html.twig at line 40
Run Code Online (Sandbox Code Playgroud)
在视图中它写道:
{% form_rest(form) %}
Run Code Online (Sandbox Code Playgroud)
我可以尝试任何form*方法.结果相同.控制器有这样的东西:
public function userEmailAddressFormAction()
{
$userEmailAddress = new UserEmailAddress();
$form = $this->createForm(new UserEmailAddressType(), $userEmailAddress);
return $this->render('MyBundle:Default:userEmailAddress.html.twig', array('form' => $form->createView()));
}
Run Code Online (Sandbox Code Playgroud)
为什么Twig不加载助手?
我有一个关于获得我的div订单的问题.
场景:我有这样的结构:
<div class="container">
<div class="element" id="element1">
<div class="element" id="element2">
<div class="element" id="element3">
<div class="element" id="element4">
Run Code Online (Sandbox Code Playgroud)
但我正在重新排序/删除/添加一些与某些条件相关的元素所以假设最终结构如下:
<div class="container">
<div class="element" id="element6">
<div class="element" id="element2">
<div class="element" id="element8">
<div class="element" id="element4">
<div class="element" id="element1">
<div class="element" id="element7">
Run Code Online (Sandbox Code Playgroud)
最后我想得到最终使用的元素列表
var ord= '';
for (i=1;i<=($('.element').length);i++){
var index = $('#element'+i).index();
ord+= index+' / ';
}
Run Code Online (Sandbox Code Playgroud)
但它给了我创建顺序中元素的索引,而不是最终顺序.最后,我认为我需要从索引中获取项目ID
var index = indexof($('#element'+i)); // ok this is not lookink like correct :)
Run Code Online (Sandbox Code Playgroud)
但我找不到.
On my collection I have the fields:
{
...
status: ['scheduled', 'sent', 'error']
sendDate: Date()
}
Run Code Online (Sandbox Code Playgroud)
My objective is to show the scheduled first, and then the error and sent sorted by { sendDate: -1 }. I would do 2 queries, but I want to keep it paginated. Because of different timezones, the sendDate might end up as scheduled before other that are already sent. Like:
{
id: 1,
sendDate: ISODate("2019-06-11T19:28:50.617Z"),
status: 'scheduled'
}, {
id: 2,
sendDate: …Run Code Online (Sandbox Code Playgroud)