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
Related
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
Following the advice from this thread, I ran the following in my existing Symfony 3.4 application's home directory:
composer require api-platform/core v2.2
... after which composer spit out a bunch of green messages confirming successful installation.
However, when I visit http://localhost:8443/ as suggested here, I get 'can't establish a connection'.
My Symfony app is still running normally when I go to http://localhost. Are there additional steps required to get the API Platform documentation running?
(For Symfony2/3)
Use this package with composer:
composer require api-platform/core
Configure the bundle manually in AppKernel.php:
$bundles = [
// [...]
new ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle(),
];
Add this in your app/config/routing.yml
api:
resource: '.'
type: 'api_platform'
prefix: '/api' # Optional
If needed, add your specific configuration in app/config/config.yml
api_platform:
title: 'specific name'
(complete configuration https://api-platform.com/docs/core/configuration/)
I hope it will help.
Created new project with appengine-starter-symfony-project (https://github.com/GoogleCloudPlatform/appengine-symfony-starter-project) and tried to run app/server as follows:
composer run-script server --timeout=0
Error recived:
// Clearing the cache for the dev environment with debug
// false
[Symfony\Component\Cache\Exception\CacheException]
Memcached >= 2.2.0 is required
Running PHP Version 7.2.8 on Xampp (Win 10) and cant see a php_memcache in ext folder.
Indeed, this is the expected behavior. If you take a look inside of config.yml you will see the following:
services:
memcache:
class: Memcache
session.handler.memcache:
class: Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcacheSessionHandler
arguments:
- "#memcache"
- { prefix: ~, expiretime: ~ }
Basically, you cache is dependent on Memchace. You can either tweak around and switch to some other vendor or install the appropriate DLL.
Hope this helps a bit...
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.
I´m trying to make working doctrine2 extensions but it still wrotes me this error:
Fatal error: Class 'Gedmo\Tree\TreeListener' not found in /data/web/virtuals/48565/virtual/www/domains/kozusnikjan.com/Symfony/app/cache/prod/appProdDebugProjectContainer.php on line 1377
And I don´t know, how to solve the problem. Please, help. Here are some files:
http://pastebin.com/k9rqvGQn -- config.yml
http://pastebin.com/TvxbvEyS -- doctrine-extensions.yml
http://pastebin.com/prUFmrTb -- AppKernel.php
http://pastebin.com/0zAaHwW9 -- DoctrineExtensionListener.php
Thank you very much
Edit:
New files:
http://pastebin.com/qEAZtFba -- composer.json
http://pastebin.com/aBnvrZj9 -- config.yml
http://pastebin.com/E1aSSddm -- appKernel.php
I edited this files. I didn´t create any file. Thank you for your help!
You're using Gedmo directly. Try through StofDoctrineExtensionsBundle...
If you are using composer add to your composer.json at require section
"stof/doctrine-extensions-bundle": "1.1.*#dev"
and run composer update. You must load bundle on AppKernel.
then put on your config.yml
stof_doctrine_extensions:
default_locale: %locale%
orm:
default:
tree: true
May be you wanna find your problem, but I use Gedmo this way and works fine.
I know it's an old Problem, but I had this one too today. Solved it by declaring the tree listener as a service:
https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/symfony2.md#doctrine-extension-listener-services
It's the same for every Gedmo extension such as translatable, sluggable, timestampable...