我正在尝试使用新的目录结构和所有内容将SF 3.3应用程序迁移到SF 4.
我在这个例外上苦苦挣扎:
编译容器时,"simplethings_entityaudit.reader"服务或别名已被删除或内联.您应该将其公开,或者直接停止使用容器并改为使用依赖注入.
(此服务来自/ vendor中的外部包).
然而,当我bin/console debug:container simplethings_entityaudit.reader看到服务存在并且是公开的时候:
Information for Service "simplethings_entityaudit.reader" ========================================================= ----------------- -------------------------------------- Option Value ----------------- -------------------------------------- Service ID simplethings_entityaudit.reader Class SimpleThings\EntityAudit\AuditReader Tags - Public yes Synthetic no Lazy no Shared yes Abstract no Autowired no Autoconfigured no Factory Service simplethings_entityaudit.manager Factory Method createAuditReader ----------------- --------------------------------------
此服务目前在我自己的一个中调用$this->container->get('simplethings_entityaudit.reader').
我也尝试注入SimpleThings\EntityAudit\AuditReader我的服务构造函数,但这是我得到的:
方法"__construct()"的参数"$ auditReader"引用类"SimpleThings\EntityAudit\AuditReader"但不存在此类服务.它无法自动注册,因为它来自不同的根命名空间.
当我将services.yaml它添加到我的工作中时,我不应该这样做:
SimpleThings\EntityAudit\AuditReader:
alias: simplethings_entityaudit.reader
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我和作曲家有问题.我在当地环境中使用git.我是唯一一个开发人员.
当我需要更多依赖项(或需要更改某些版本)时,我编辑composer.json并在composer install本地运行.
一切安好.
然后,当一切都在本地工作时,我提交我的更改(包括composer.json和composer.lock)并推送到我的生产服务器.
一个后收到-脚本更新的来源和运行composer install在远程服务器上.
预期结果:
怎么了 :
警告:锁定文件与composer.json中的最新更改不是最新的.您可能会过时的依赖项.运行更新以更新它们.
composer update以使工作正常,但我知道composer update在生产服务器上不建议使用a.这是收发后作曲家部分的输出:
composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You …Run Code Online (Sandbox Code Playgroud) 我拼命想让Chrome Headless在我的生产服务器(Ubuntu 16.04)上运行.
当我运行以下命令时:
google-chrome --headless --disable-gpu --dump-dom http://www.example.org/
该DOM会,当我运行它只能倾倒root与--no-sandbox标志.与其他用户一起运行时,输出如下:
[0312/110057.072748:ERROR:gpu_process_transport_factory.cc(1019)] Lost UI shared context.
<html><head></head><body></body></html>
Run Code Online (Sandbox Code Playgroud)
我曾尝试与google-chrome-stable和chromium-browser,同样的结果:它只能作为root与--no-sandbox标志.
我不认为这是一个依赖问题,因为它作为root正常工作.
我已经设置了一个Ubuntu 16.04虚拟机,可以让它与任何用户一起工作,我只是在我的生产服务器上没有成功.
有任何想法吗?
我想在Api-Platform中使用YAML而不是注释.
我没有使用Api-Platform发行版,而是将api-pack添加到我现有的Symfony Flex项目中(composer req api).
文档说YAML文件应该在,/config/api_platform/resources.yaml但我的实体没有被发现.
我应该在其他地方配置什么?
谢谢你,本
According to the documentation, a command class must extend Command or ContainerAwareCommand to be automatically discovered and registered (provided its bundle is registered in the Kernel, of course).
Since Symfony 4+, this discovery doesn't work as expected.
Try this:
composer create-project symfony/skeleton test-maxmind-sf4
cd test-maxmind-sf4
composer req cravler/maxmind-geoip-bundle dev-master
php bin/console list
Run Code Online (Sandbox Code Playgroud)
You will notice that:
有人知道如何在集合上添加额外数据吗?\n该文档详细介绍了如何在项目上添加额外数据,这转化为装饰 ItemNormalizer 服务,并且效果非常好。
\n\n但是当涉及到在实体集合上添加一些数据时,我\xe2\x80\x99m 努力寻找要装饰的规范化器。额外的数据可以是任何内容:当前登录的用户、详细的寻呼机、一些调试参数……与特定实体无关,而是与请求本身相关。
\n\n目前唯一可行的解决方案是挂钩内核事件,但这绝对不是我喜欢编写的代码:
\n\nuse ApiPlatform\\Core\\EventListener\\EventPriorities;\nuse Symfony\\Component\\EventDispatcher\\EventSubscriberInterface;\nuse Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent;\nuse Symfony\\Component\\HttpKernel\\KernelEvents;\nuse Symfony\\Component\\Security\\Core\\Security;\nuse Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface;\n\nfinal class SerializeListener implements EventSubscriberInterface\n{\n /**\n * @var Security\n */\n private $security;\n\n /**\n * @var NormalizerInterface\n */\n private $normalizer;\n\n public function __construct(\n Security $security,\n NormalizerInterface $normalizer\n ) {\n $this->security = $security;\n $this->normalizer = $normalizer;\n }\n\n public function addCurrentUser(GetResponseForControllerResultEvent $event)\n {\n $request = $event->getRequest();\n if ($request->attributes->has(\'_api_respond\')) {\n $serialized = $event->getControllerResult();\n $data = json_decode($serialized, true);\n $data[\'hydra:user\'] = $this->normalizer->normalize(\n $this->security->getUser(),\n $request->attributes->get(\'_format\'),\n $request->attributes->get(\'_api_normalization_context\')\n );\n $event->setControllerResult(json_encode($data));\n …Run Code Online (Sandbox Code Playgroud) symfony4 ×3
symfony ×2
symfony-flex ×2
chromium ×1
composer-php ×1
deployment ×1
git ×1
php ×1
ubuntu ×1