尝试注册一个原则EventSubscriber,但实际上没有任何东西被触发。
在这个实体上,我已经设置了@ORM\HasLifeCycleCallbacks注释。
这是订户:
<?php
namespace App\Subscriber;
use App\Entity\User;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Doctrine\ORM\Events;
use Sy
以https://symfony.com/doc/current/event_dispatcher.html为例 class ExceptionSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
// return the subscribed events, their methods and priorities
return [
KernelEvents::EXCEPTION
我创建了一个订阅者并注册了一个新的服务,我所做的:
<?php
namespace My\BlogBundle\Listener;
use Doctrine\ORM\Events;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
class BlogArticle
我正在尝试在FOSUserBundle上实现事件
<?php
namespace EasyApp\UserBundle\Service;
use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Doctrine\Bundle\DoctrineBundle\Registry as Doctrine;
use EasyApp\UserBundle\Entity\UserLogin;
use FOS\Use
我正在使用API-Platform来做一个项目等。在这个项目中,我有两个由ManyToOne关系关联的资源(贡献者和唐)。一个Don转给一个捐赠者,一个捐赠者可以转给更多的Dons。我有一个数据持久化在数据库中的资源。 Donateur.php <?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\DonateurRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctri
在将User对象持久化到数据库之前,我希望将Doctrine事件侦听器注册到散列用户密码:
这是我的事件侦听器类:
<?php
namespace AppBundle\Doctrine;
use AppBundle\Entity\User;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
class HashPasswordL
当%1由Symfony管理,而其他不是时,我有%2个实体
非Symfony管理的实体
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* User
*
* @ORM\Table(name="p_user")
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
*/
class User
{
/**
* @var int
*
* @ORM\Column(name="
在symfony 3中,我订阅了
FOSUserEvents::REGISTRATION_COMPLETED用地址数据填充第二个表并写入日志。
namespace AppBundle\EventListener;
use AppBundle\Entity\Address;
use Doctrine\ORM\EntityManager;
use Psr\Container\ContainerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use FOS\UserBundle\FOSUserEv
我有一个使用Doctrine和liip_test_fixtures_bundle的Symfony应用程序。
5.3.11Doctrine PHP版本: 7.4.25Symfony运行时版本: DBAL: 3.2.0
我设置了Doctrine来使用sqlite连接进行测试。在运行测试时,我得到以下错误:
Doctrine\DBAL\Exception\SyntaxErrorException: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 near "(": syn
我正在努力使使用symfony2构建的一个旧的php项目工作。当我想要装载固定装置时:
php app/console doctrine:fixtures:load --env=test
我发现了一个错误:
[Gedmo\Exception\UnsupportedObjectManagerException]
Given object manager is not managed by wrapper
完整的追踪:
# php app/console doctrine:fixtures:load --verbose
Careful, database will be purged. Do
我使用symfony 2.4.2 :在执行此命令时:
php应用程序/控制台原则:生成:实体SdzBlogBundle:文章
我的控制台中有一个错误:
PHP Unknown error: getEntityNamespace is deprecated since Symfony 2.1. Use getA
liasNamespace instead in C:\wamp\www\Symfony1\vendor\doctrine\doctrine-bundle\Do
ctrine\Bundle\DoctrineBundle\Registry.php on line 129
PHP Sta
我正在尝试为我的项目构建一个事件侦听器,并遵循本指南的说明:我像在教程中一样编辑了我的services.xml,但是当我想要测试它时,我得到了这个错误消息:
InvalidArgumentException: There is no extension able to load the configuration for "doctrine:config" (in /var/www/symfony/src/Acme/AppBundle/DependencyInjection/../Resources/config/services.xml). Looked for namesp
我更新symfony版本5.4到6.1,我有此错误,在论坛上找不到解决方案(我认为同时存在几个问题):
Fatal error: Declaration of App\Repository\UserRepository::upgradePassword(Symfony\Component\Security\Core\User\UserInterface $user, string $newEncodedPassword): void must be compatible with Symfony\Component\Security\Core\User\PasswordUpgraderInte
我不知道是symfony还是理论问题,我想给我的表加上前缀,我设法给它们加了前缀,但现在我想为其中一些加前缀,所以我试着这样做。什么都不会发生,没有前缀
在应用程序\ eventListener中的我的事件中:`
<?php
namespace App\Event;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
class TablePrefixEven
我正在开发一个Symfony 2应用程序,在集成Sylius产品包的过程中,我在运行时得到了以下错误
php app/console doctrine:schema:update --force
错误是
The class sylius.model.product_archetype.class does not exist.
配置这是我的confi.yml文件
sylius_cart:
resolver: app.cart_item_resolver # The id of our newly created service.
classes: ~ # This
当我调用"/web/app_dev.php/en_US/admin/cmf/block/simpleblock/list“(它应该打印简单块的列表)时,我会收到以下错误:
Warning: Missing argument 1 for Doctrine\ODM\PHPCR\Query\QueryBuilder::from(), called in vendor/sonata-project/doctrine-phpcr-admin-bundle/Sonata/DoctrinePHPCRAdminBundle/Model/ModelManager.php on line 218 and
在我开始和作曲家打交道之前,我的Symfony2设置很棒。
我确实用Composer安装了Symfony2,但随后手动添加了包--包括我自己创建的包。
然后,我需要添加一些对作曲家来说似乎更容易的东西。当我在浏览器中运行时,AppKernel.php中出现了一个错误,说明不存在任何捆绑包,包括:
FatalErrorException: Error: Class 'Acme\DemoBundle\AcmeDemoBundle' not found in /path/app/AppKernel.php line 39
我100%的文件夹是存在的,除了运行各种编写器命令之外,没有什
我是symfony和postgreSQL的新手,我正在尝试保存数据库更新/删除的日志,我已经创建了这个表
CREATE TABLE "public"."changes" (
"id" INT NOT NULL ,
"id_user" INT NOT NULL,
"operation" VARCHAR(45) NOT NULL,
"table" VARCHAR(45) NOT NULL,
"column" VARCHAR(45) NOT NULL,
"
我更新了我的composer.json文件以反映6.0.*更改,并运行了我的composer update "symfony/*"代码,它返回如下:
Problem 1
- doctrine/doctrine-bundle is locked to version 2.4.3 and an update of this package was not requested.
- doctrine/doctrine-bundle 2.4.3 requires symfony/config ^4.4.3|^5.0|^6.0 -> found symfon
在正式文档中,它说这是第一步
$ composer require friendsofsymfony/user-bundle "~2.0"
这还我这个错误
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Pr