基本上有属性表和转换表 - 一个属性的许多翻译.
我需要为指定语言中的每个属性选择翻译的id和值,即使该语言中没有翻译记录.我错过了一些连接技术或连接(不涉及语言表)在这里不起作用,因为以下不返回具有指定语言的非现有翻译的属性.
select a.attribute, at.id, at.translation
from attribute a left join attributeTranslation at on a.id=at.attribute
where al.language=1;
Run Code Online (Sandbox Code Playgroud)
所以我使用这样的子查询,这里的问题是使用相同的参数对同一个表进行两个子查询(感觉就像性能耗尽,除非mysql对那些组合,我怀疑它因为它会让你做很多类似的子查询)
select attribute,
(select id from attributeTranslation where attribute=a.id and language=1),
(select translation from attributeTranslation where attribute=a.id and language=1),
from attribute a;
Run Code Online (Sandbox Code Playgroud)
我希望能够从一个查询中获取id和翻译,所以我将列连接并稍后从字符串中获取id,这至少会产生单个子查询,但仍然看起来不正确.
select attribute,
(select concat(id,';',title)
from offerAttribute_language
where offerAttribute=a.id and _language=1
)
from offerAttribute a
Run Code Online (Sandbox Code Playgroud)
所以问题部分.有没有办法从单个子查询中获取多个列,或者我应该使用两个子查询(mysql是否足够聪明地将它们分组?)或者加入以下方式:
[[语言属性]到翻译](加入3个表似乎比子查询更差).
使用Symfony2和Sonata,在列表中,字段模板可以被覆盖并将变量分配给模板,即setTemplateVar(),有时可能有用!(不是说'attr'用于此目的的形式,而是列出......)
我想知道将变量传递给在configureListFields方法中为listmapper的给定字段定义的模板的最佳方法是什么?
<?php
namespace Acme\AcmeBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Validator\ErrorElement;
use Sonata\AdminBundle\Form\FormMapper;
class AcmeAdmin extends Admin
{
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('acme_field')
->add('date', 'date', array(
'template' => "AcmeBundle:CRUD:list_date.html.twig",
// 'dateFormat' => "Y-m-d",// ---> how to pass this var to twig ?
))
->add('_action', 'actions', array(
'actions' => array(
'edit' => array(),
'delete' => array(),
),
))
;
}
Run Code Online (Sandbox Code Playgroud)
使用twig模板已经实现了翻译和格式化日期的特定问题的解决方案,如下所示:
{% block field%}
{% if value is empty %}
{% else %}
{# retrieving the …Run Code Online (Sandbox Code Playgroud) 在Chrome版本26.0.1410.43米,我想知道是否有人注意到以下问题...
激活chrome-devtools检查器时,光标不再出现在悬停的链接上...
此外,还有一个应用于链接的用户代理样式表
a:-webkit-any-link {
color: -webkit-link;
text-decoration: underline;
cursor: auto;
}
Run Code Online (Sandbox Code Playgroud)
这是否与以下内容重复,因为在最新版本的Chrome上也会出现这种情况?鼠标悬停在锚标签上不显示指针光标.在Chrome上观察到的行为,在IE 9上运行良好?
这也很有趣但不显示光标更改... 如何使用chrome Web检查器查看悬停代码
是否有任何设置可用于防止这种情况?
谢谢