小编Alb*_*sús的帖子

断言表达式验证在Symfony 2.4中的属性级别上不起作用

我正在尝试通过@Assert \ Expression(http://symfony.com/doc/2.4/reference/constraints/Expression.html)在字段级别验证属性。

它可以在以下代码的类级别工作:

/**
 * Foo
 * 
 * @ORM\Table(name="foo")
 * @ORM\HasLifecycleCallbacks()
 * @UniqueEntity("slug")
 * @Assert\Expression(
 *     "this.getPriceFor2PaxStandard() != null or (this.getPriceFor2PaxStandard() == null and !this.isPriceForAccLevelRequired('standard'))",
 *     message="The price for 2 pax standard is required",
 *     groups={"agency_tripEdit_finalsave"}
 * )
 * 
 */
class Foo implements ISpellcheckerLocaleProvider, ProcessStatusAware, DataTransformer
{
Run Code Online (Sandbox Code Playgroud)

但是如果我在属性级别使用相同的代码(应该没问题)不起作用:

/**
     * @var decimal
     *
     * @ORM\Column(name="price_for_2_pax_standard", type="decimal", precision=16, scale=4, nullable=true)
     * @Assert\Expression(
     *     "this.getPriceFor2PaxStandard() != null or (this.getPriceFor2PaxStandard() == null and !this.isPriceForAccLevelRequired('standard'))",
     *     message="The price for 2 pax …
Run Code Online (Sandbox Code Playgroud)

validation assert symfony

4
推荐指数
1
解决办法
2753
查看次数

设置用户ID后,Google Analytics(分析)通用版不会跟踪页面浏览量或事件

最近,我们更新了系统,以与Google Analytics Universal合作。我们迁移了该物业以使用通用分析,几天后,我们根据指南进行了代码更改:https : //developers.google.com/analytics/devguides/collection/upgrade/guide

我们进行了更改,以也使用用户ID功能。通常会跟踪每个事件或页面视图,但是会完成目标(当用户到达特定页面时最终完成)。

我们在8月6日中午引入了用户ID,正如您所看到的,目标达到后的第二天是0(尽管由于我们的数据库,我可以说大约是25)。第二天(第8天),目标(如前所述,设置了用户ID的综合浏览量)将再次正常跟踪。第9天只有几个(还有更多)。从那天起,根本就没有追踪到。

分析目标

一开始,我相信由于用户ID的原因,将数据整合在一起需要花费更长的时间进行分析,但是在我看来,这很奇怪。

我使用的代码是:

    <!-- Google Analytics Universal-->
<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-xxxxxxx-y', {
        'cookieDomain': 'xxxxxxx.xx',
        'siteSpeedSampleRate': 25
    });


    {% if userId is set %}
        ga('set', '&uid', userId);
    {% endif %}


     ga('send', 'pageview');
Run Code Online (Sandbox Code Playgroud)

一切都非常简单,我还使用了Google Analytics(分析)调试工具来检查是否所有数据都已发送,是的,是否已发送。除此之外,如果我到达一个自己跟踪目标的页面,则可以实时查看我的会话,因此数据将发送到分析。

这就是为什么我认为我从Google Analytics(分析)方面缺少一些配置。我已经创建了一个用户ID视图,并且其中的数据包含相同的信息,但是仅从8月6日开始使用用户ID功能。

有人有想法或有同样的麻烦吗?

谢谢!

google-analytics userid universal-analytics

3
推荐指数
1
解决办法
1711
查看次数