我需要格式化错误消息并以JSON格式输出它。
我有以下事件订阅者:
namespace App\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\KernelEvents;
final class ExceptionSubscriber implements EventSubscriberInterface
我在symfony2中有3种表单类型
FaultType,它是所有后续集合的父级
<?php
namespace My\FaultBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
class FaultType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder
我被困在这里了。我试图在Ajax Action中包含一个EventDispatcher,但是它悄悄地失败了。我是symfony的新手,目前正在对基于symfony 1.1.6的"VImp“内容管理系统()进行定制。
在/apps/xx/modules/xx/actions/base/BaseXxActions.php中是这样的:
public function executeAjax {
switch($this->getVar('action')) {
case 'something':
我有一个过滤器的形式,这是过滤市场,类型和航空公司。提交时,我希望在所选值之后过滤另一个下拉列表(documentlist)。因此,我创建了一个正常工作的post_submit事件侦听器(我转储了以下代码中的值)。但是,当尝试通过查询构建器并使用来自我的过滤器的数据更新documentlist值时,它不起作用。任何想法:
<?php
namespace DocumentBundle\Form\Document;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInte
我在实体中有这个代码:
/**
* @Assert\Type(
* type="real",
* message="Price for vehicle service must be real number."
* )
*
* @ORM\Column(name="min_price", type="float")
*/
protected $minPrice;
但是,如果在此表单字段中输入了非整数值,则Symfony返回默认的地区错误消息
我有一个日志记录功能,可以跟踪页面数量。我想补充一下我在Symfony已经拥有的每一条路线。
目前我是这样做的:
/**
* @Route("/test", name="test")
*/
public function testAction(Request $request)
{
/* Function to register pageload */
$this->get('statsd')->countMetric('visitor.'.$request->get('_rout
我正在检查用户是否允许他们登录,如果没有,就用他们所在地区的语言显示一条错误消息。这是一款Symfony 4.2应用程序。下面是我的用户检查器(可以正常工作): <?php
namespace App\Security;
use App\Entity\User as AppUser;
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
use Symfony\Component\Security\Core\User\UserCheckerInterface;
u