I'm upgrading a existing Symfony 3.3 application to Symfony 3.4.
I'm getting a console command auto-registration warning in spite of the fact that I've defined the command in the bundle's services.yml file. The warning:
[2017-12-14 12:22:19] php.INFO: User Deprecated: Auto-registration of
the command "Dplh\DplhIssuesBundle\Command\IssuesReportCommand" is
deprecated since Symfony 3.4 and won't be supported in 4.0. Use PSR-4
based service discovery instead.
The entry in Dplh/DplhIssuesBundle/Resources/config/services.yml:
services:
Dplh\DplhIssuesBundle\Command\IssuesReportCommand:
public: true
tags: ['console.command']
calls:
- [ saveDependencies, [ '#logger' ]]
I am positive that the services.yml file is being processed by Symfony because if I intentionally create a syntax error in it, Symfony reports that the file contains invalid YAML.
Finally found it.
There was a reference to the Dplh\DplhIssuesBundle\Command\IssuesReportCommand class in another bundle's services.yml file (copy/paste error, I'm sure).
Removing that reference removed the error.
Related
I'm upgrading to Symfony 4.4 from from Symfony 3.4 and the parameters now use .env but terminal commands return the error message
In ParameterBag.php line 95:
You have requested a non-existent parameter "secret". Did you mean this: "kernel.secret"?
the file config/packages/framework.yaml looks like this
framework:
secret: '%env(APP_SECRET)%'
I run 'composer dump-env dev' it returns the secret.
Any ideas why it's not found? what I need to resolve this? thanks
Seems like I had a '%secret' defined in security.yaml taken from version 3.4 so commented that out
#remember_me:
#secret: '%secret%'
I have an installation of Symfony 4.3 and I upgrade it to 4.4.19.
On my old installation Sentry was working well with excluded_exception.
I use it like this on sentry.yaml :
sentry:
dsn: "https://key#sentry.io/id"
options:
excluded_exceptions:
- App\Exception\BadArgumentException
- App\Exception\BadFilterException
- App\Exception\BadRequestException
But when I upgrade to 4.4.19 symfony logs tells me that excluded_exceptions does not exist.
Sentry get each exception on my project. It works well so I don't understand why it doesn't recognize this option. (I've seen that it was add to sentry on v2.1).
I've tried to do a composer update sentry/sentry-symfony but nothing changes.
On my composer.json I have this on require part :
"sentry/sentry": "^3.1", "sentry/sentry-symfony": "^4.0",
So I don't know what to do now to fix this problem. I must forgot something maybe.
Please check upgrade file for Sentry Symfony 4.0.
According to this file sentry.options.excluded_exceptions configuration option was removed.
To exclude exceptions you must use IgnoreErrorsIntegration service:
sentry:
options:
integrations:
- 'Sentry\Integration\IgnoreErrorsIntegration'
services:
Sentry\Integration\IgnoreErrorsIntegration:
arguments:
$options:
ignore_exceptions:
- App\Exception\BadArgumentException
- App\Exception\BadFilterException
- App\Exception\BadRequestException
I want to create a new entity in my ORO platform application by using the make:entity command from the MakerBundle.
I expect it to create an entity in my bundle Acme\Bundle\TestBundle which I set in my config_dev.yml by using:
maker:
root_namespace: 'Acme\Bundle\TestBundle'
So I execute
bin/console make:entity Test
which returns
! [NOTE] It looks like your app may be using a namespace other than "Acme\Bundle\TestBundle".
!
! To configure this and make your life easier, see:
! https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html#configuration
created: src/Acme/Bundle/TestBundle/Entity/Test.php
created: src/Acme/Bundle/TestBundle/Repository/TestRepository.php
[ERROR] Only annotation mapping is supported by make:entity, but the
<info>Acme\Bundle\TestBundle\Entity\Test</info> class uses a different format. If you would like
this command to generate the properties & getter/setter methods, add your mapping configuration, and then
re-run this command with the <info>--regenerate</info> flag.
I've tried to run the command once again, which works. But obviously this is not the way how it's meant to work. So how can I fix this mapping error?
I started with the standard Symfony 5 project by using Symfony new myapp.
I add the config file in config/packages/dev/maker.yaml
maker:
root_namespace: 'App\Core'
To generate the entity in the src/Core folder, I got the following error:
➜ symfony console make:entity Post
created: src/Core/Entity/Post.php
created: src/Core/Repository/PostRepository.php
[ERROR] Only annotation mapping is supported by make:entity, but the <info>App\Core\Entity\Post</info> class uses
a different format. If you would like this command to generate the properties & getter/setter methods, add your
mapping configuration, and then re-run this command with the <info>--regenerate</info> flag.
To avoid showing the error in the console, I install the patch created by vklux / maker-bundle-force-annotation
Step 1: install package
composer require cweagans/composer-patches
Step 2: apply the patch in composer.json
{
// {...} composer.json content
"extra": {
"patches": {
"symfony/maker-bundle": {
"Provide flag to force annotation in make entity command": "https://raw.githubusercontent.com/vklux/maker-bundle-force-annotation/master/maker-force-annotation-flag.patch"
}
}
}
}
Step 3: composer update
composer update
Step 4: try make:entity with the additional command option
➜ symfony console make:entity Post --force-annotation
created: src/Core/Entity/Post.php
created: src/Core/Repository/PostRepository.php
Entity generated! Now let's add some fields!
You can always add more fields later manually or by re-running this command.
New property name (press <return> to stop adding fields):
>
✅ 🚀 👍 Everything works fine now.
It's a bug in the doctrine version please try this version good luck
composer req doctrine/doctrine-bundle:2.2
I found a solution to create new entities with Symfony maker using doctrine/doctrine-bundle version higher than 2.2.4
These steps worked for me with:
"doctrine/doctrine-bundle": "^2.7"
PHP 8.1 (I migrate from php 7.4 in my case)
STEP 1: replace type: annotation by type: attribute inside doctrine.yaml
STEP 2: Enter entity root with namespace:
symfony console make:entity App\Entity\test
When I enable the 'dev' mode in my Symfony 4 app (that is already online in a shared hosting service) it shows this message:
(1/1) ParameterNotFoundException
You have requested a non-existent parameter "locale".
in ParameterBag.php (line 100)
at ParameterBag->get('locale')
in EnvPlaceholderParameterBag.php (line 57)
at EnvPlaceholderParameterBag->get('locale')
in ParameterBag.php (line 216)
at ParameterBag->resolveString('%locale%', array('locale' => true))
in ParameterBag.php (line 187)
...
and does not allow to debug the app. My config/services.yml code is as default:
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: 'en'
services:
# default configuration for Services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your Services.
autoconfigure: true # Automatically registers your Services as commands, event subscribers, etc.
public: false # Allows optimizing the container by removing unused Services; this also means
# fetching Services directly from the container via $container->get() won't work.
# The best practice is to be explicit about your dependencies anyway.
...
Please, someone can help me to fix this error.
Had the same problem during the fresh symfony 4.3 + sonata admin bundle installation.
As a solution I added locale parameter:
// /config/services.yaml
parameters:
locale: 'en'
While I am not a Symphony expert the documentation appears to allow anything in the parameters section, but it does mention also defining the values in the .env.dist file as well for them to be used here.
http://symfony.com/doc/current/best_practices/configuration.html#canonical-parameters
When upgrading from symfony 4.2 to symfony 4.4 I also got this error when composer commands.
This parameter seems so be used in config/packages/translation.yml.
Updating the symfony/translation recipe which no longer refers to %locale% but hardcode 'en' solves the problem for me.
Simply run composer recipes:install symfony/translation --force -v
I am trying to deploy an existing Symfony 2.1 application to Azure. For this I am using the Azure Distribution Bundle, and I am trying to deploy assets to Azure as documented here.
However, I am getting an error when doing windowsazure:package to create the package:
Catchable Fatal Error: Argument 2 passed to WindowsAzure\DistributionBundle\Deployment\Assets\BlobStrategy::__construct() must be an instance of WindowsAzure\Blob\BlobRestProxy, none given, called in C:\IGPR\igpr\app\cache\azure\appAzureDebugProjectContainer.php on line 2361 and defined in C:\IGPR\igpr\vendor\beberlei\azure-distribution-bundle\WindowsAzure\DistributionBundle\Deployment\Assets\BlobStrategy.php line 35
Here is the relevant section of my config.yml:
windows_azure_distribution:
...
services:
blob:
default: UseDevelopmentStorage=true
azureprod: DefaultEndpointsProtocol=http;AccountName=myaccountname;AccountKey=MyVeryLongAccOUntKeY==
assets:
type: blob
connection_name: azureprod
Any ideas? Seems that the Blob proxy cannot be created. I get the same error if I try to use the local development storage.
The bundle is installed via Composer.
Looks like this was a bug in the Azure Distribution Bundle, which the maintainer has now fixed.