I recently made a composer update on my Symfony app (2.7). Since I did this update, swiftmailer went from 2.4 to 2.5 and after the command, the console displayed me this error:
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
Unable to replace alias "swiftmailer.mailer.default.transport.real" with actual definition "mail".
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
You have requested a non-existent service "mail".
I tried to remove the swiftmailer directory in "vendor", but it didnt work.
Here's my composer.json:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": { "": "src/" }
},
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.7.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "dev-master"
},
"require-dev": {
"sensio/generator-bundle": "~2.3",
"symfony/phpunit-bridge": "~2.7"
},
"scripts": {
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"#symfony-scripts"
],
"post-update-cmd": [
"#symfony-scripts"
]
},
"config": {
"bin-dir": "bin",
"platform": {
"php": "7.0"
}
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.7-dev"
}
}
}
Thank you in advance for your help.
This has definitely been happening since today. (I'm on Symfony 2.8.17.) Reverting the Swiftmailer bundle back to version 2.4 fixed this for me.
In your composer.json file change
"symfony/swiftmailer-bundle": "~2.3",
to
"symfony/swiftmailer-bundle": "2.4",
Now do a composer update so you go back to version 2.4 of the Swiftmailer bundle and all should be well. Looks like there is a bug in the 2.5 update.
--
If you're still having problems try these commands to fully flush out cache:
rm -rf app/cache/*
rm app/bootstrap.php.cache
Also check your composer.lock file to ensure that the Swiftmailer bundle really has reverted back to 2.4. You should see a section like this:
{
"name": "symfony/swiftmailer-bundle",
"version": "v2.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/swiftmailer-bundle.git",
"reference": "ad751095576ce0c12a284e30e3fff80c91f27225"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/swiftmailer-bundle/zipball/ad751095576ce0c12a284e30e3fff80c91f27225",
"reference": "ad751095576ce0c12a284e30e3fff80c91f27225",
"shasum": ""
},
"require": {
"php": ">=5.3.2",
"swiftmailer/swiftmailer": ">=4.2.0,~5.0",
"symfony/config": "~2.7|~3.0",
"symfony/dependency-injection": "~2.7|~3.0",
"symfony/http-kernel": "~2.7|~3.0"
},
"require-dev": {
"symfony/console": "~2.7|~3.0",
"symfony/framework-bundle": "~2.7|~3.0",
"symfony/phpunit-bridge": "~2.7|~3.0",
"symfony/yaml": "~2.7|~3.0"
},
"suggest": {
"psr/log": "Allows logging"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Bundle\\SwiftmailerBundle\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien#symfony.com"
}
],
"description": "Symfony SwiftmailerBundle",
"homepage": "http://symfony.com",
"time": "2016-12-20T04:44:33+00:00"
},
Most likely the issue you're describing was not caused by a bug, but by changed related dependency to swiftmailer/swiftmailer.
You have requested a non-existent service "mail". says that a service mail is missing, Unable to replace alias "swiftmailer.mailer.default.transport.real" with actual definition "mail". is a broad hint that this is related to swfitmailer transport mail, the class Swift_Transport_MailTransport using insecure php mail() function. This transport is deprecated since
swiftmailer version 5.4.5 for security reasons.
In order to fix the issue, you need to
switch from transport mail to a transport supported by current swiftmailer, or
add "swiftmailer/swiftmailer": "<6.0" to your composer.json dependencies in order to prevent packages from installing swiftmailer v6.x where Swift_Transport_MailTransport is gone. Unfortunately, symfony/swiftmailer-bundle requires swiftmailer v6.x starting from v3.0.0, so you would need to require "symfony/swiftmailer-bundle": "^2"
Related
I'm currently creating a website with Symfony3.2.4, I've installed Sonata News Bundle on my website.
I'm trying to having an access to my website but Symfony show me an error.
Type error: Return value of Sonata\UserBundle\SonataUserBundle::registerFormMapping() must be an instance of Sonata\UserBundle\void, none returned
I don't know from where this error is coming for and how to fix it...
Here is my composer.json :
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": {
"AppBundle\\": "src/AppBundle",
"Application\\": "src/Application"
},
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"autoload-dev": {
"psr-4": { "Tests\\": "tests/"
},
"files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
},
"require": {
"php": ">=5.6",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"incenteev/composer-parameter-handler": "^2.0",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^5.0.0",
"sonata-project/admin-bundle": "^3.23",
"sonata-project/doctrine-orm-admin-bundle": "^3.1",
"sonata-project/news-bundle": "^3.1",
"sonata-project/user-bundle": "^3.3",
"symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/swiftmailer-bundle": "^2.6.4",
"symfony/symfony": "3.4.*",
"twig/twig": "^1.0||^2.0"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0",
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
},
"scripts": {
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"#symfony-scripts"
],
"post-update-cmd": [
"#symfony-scripts"
]
},
"config": {
"preferred-install": "dist",
"platform": {
"php": "5.5.9"
},
"sort-packages": true
},
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "3.4-dev"
}
}
}
I've got no idea from where this coming this error and hox to fix it.
That's why I request your help ^^.
Thanks a lot.
I had the same problem with my app. It turned out I was using PHP 7.0 and void is a feature introduced in PHP 7.1 (http://php.net/releases/7_1_0.php).
Please double check you are using PHP 7.1+.
I forked this bundle "[egeloen/ivory-google-map][1]"
[1]: https://github.com/egeloen/ivory-google-map/ to this [repository][1]
[1]: https://github.com/spinoza123/ivory-google-map and i changed the original url in composer.json to my forked repository, but when i do composer update i have this error
[InvalidArgumentException]
Could not find a matching version of package spinoza123/google-map. Check the package spelling, your version constr
aint and that the package is available in a stability which matches your minimum-stability (stable).
Must i publish it in pakagist, if yes is it free and how to do that ?
my composer.json
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": {
"AppBundle\\": "src/AppBundle"
},
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"autoload-dev": {
"psr-4": { "Tests\\": "tests/" },
"files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
}
"require": {
"php": ">=5.5.9",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"incenteev/composer-parameter-handler": "^2.0",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^5.0.0",
"symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/swiftmailer-bundle": "^2.6.4",
"symfony/symfony": "3.4.*",
"twig/twig": "^1.0||^2.0",
"spinoza123/ivory-google-map": "dev-master"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
},
"scripts": {
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"#symfony-scripts"
],
"post-update-cmd": [
"#symfony-scripts"
]
},
"config": {
"platform": {
"php": "5.5.9"
},
"sort-packages": true
},
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "3.4-dev"
}
}
}
Thanks
Use VCS in your composer.json
There are a few use cases for this. The most common one is maintaining your own fork of a third party library. If you are using a certain library for your project and you decide to change something in the library, you will want your project to use the patched version. If the library is on GitHub (this is the case most of the time), you can simply fork it there and push your changes to your fork.
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/spinoza123/ivory-google-map"
}
],
"require": {
"egeloen/ivory-google-map": "dev-master"
}
}
I try to install aimeos bundle for symfony and i get these errors:
Your version of PHP, 5.5.1, is affected by CVE-2013-6420 and cannot
safely perfo rm certificate validation, we strongly suggest you
upgrade. Loading composer repositories with package information
Updating dependencies (including require-dev) Your requirements could
not be resolved to an installable set of packages.
Problem 1
- Installation request for aimeos/aimeos-symfony ~2016.04 -> satisfiable by aimeos/aimeos-symfony[2016.04.1].
- aimeos/aimeos-symfony 2016.04.1 requires aimeos/ai-symfony dev-master -> no matching package found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your min imum-stability setting
This is my composer.json file on the root of my symfony folder:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": { "": "src/" },
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"prefer-stable": true,
"minimum-stability": "dev",
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"aimeos/aimeos-symfony": "~2016.04"
},
"require-dev": {
"sensio/generator-bundle": "~3.0",
"symfony/phpunit-bridge": "~2.7"
},
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget",
"Aimeos\\ShopBundle\\Composer\\ScriptHandler::installBundle",
"Aimeos\\ShopBundle\\Composer\\ScriptHandler::setupDatabase"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget",
"Aimeos\\ShopBundle\\Composer\\ScriptHandler::installBundle",
"Aimeos\\ShopBundle\\Composer\\ScriptHandler::setupDatabase"
]
},
"config": {
"bin-dir": "bin",
"platform": {
"php": "5.3.9"
}
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.8-dev"
}
}
}
The 2016.04.1 version of the Aimeos bundle for Symfony references accidentally other dev-master packages and therefore requires this line in your composer.json:
"minimum-stability": "dev",
A new version fixing the problem will be released tomorrow.
I can not get Moltin Cart plugin to install for symfony 2.7. I get following issues when I try to install.
Problem 1
- Installation request for moltin/cart dev-master -> satisfiable by moltin/c
art[dev-master].
- moltin/cart dev-master requires moltin/tax dev-master -> no matching packa
ge found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your min
imum-stability setting
This is my composr.lock
.....
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.3.3"
},
.....
And this is my composer.json complete file
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/", "SymfonyStandard": "app/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.5.*",
"doctrine/orm": "~2.2,>=2.2.3,<2.5",
"doctrine/dbal": "<2.5",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0,>=3.0.12",
"sensio/framework-extra-bundle": "~3.0,>=3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"symfony/var-dumper": "^2.7",
"jms/serializer-bundle": "^1.0",
"symfony/finder": "^2.7",
"moltin/cart": "dev-master"
},
"require-dev": {
"sensio/generator-bundle": "~2.3"
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\\Composer::hookRootPackageInstall"
],
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.5-dev"
}
}
}
This is Moltin/cart site page link. It would be great help if someone can look into it.
If you want to install a package that depends on non-stable packages, you will to explicitly require those packages too or lower the minimum stability setting in your project's Composer configuration.
I have build a library using some of the Symfony2 components and Doctrine. I now want to use this library inside a Symfony2 console app. I have included my library through Composer as a vendor, however, I'm getting the following error when I execute my library code:
PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Bundle "default" does not exist or it is not enabled.' in /home/user/project/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php:90
I'm not sure what the "default" bundle would be, how this is related to Doctrine or how to start to debug this.
Any help much appreciated.
UPDATE:
This is the Composer.json for my console app:
{
"name": "my/console",
"type": "application",
"repositories": [
{
"type": "vcs",
"url": "git#bitbucket.org:my/library.git"
}
],
"require": {
"php": ">=5.3.3",
"my/library": "dev-dev-master"
},
"autoload": {
"psr-0": {
"My\\": ["src/"]
}
}
}
This is the Composer.json for my library:
{
"name": "my/library",
"type": "library",
"keywords": [
"my", "library"
],
"homepage": "https://www.mine.com/",
"autoload": {
"psr-0": { "My\\": ["src/"] }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.3.*",
"doctrine/orm": "2.3.*",
"doctrine/doctrine-bundle": "1.2.*",
"twig/extensions": "1.0.*",
"symfony/swiftmailer-bundle": "2.3.*",
"symfony/monolog-bundle": "2.3.*",
"sensio/distribution-bundle": "2.3.*",
"sensio/framework-extra-bundle": "2.3.*",
"sensio/generator-bundle": "2.3.*",
"underscore/underscore.php": "1.3.1",
"sami/sami": "v1.1"
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "stable",
"extra": {
"symfony-app-dir": "app"
}
}
You can see what is causing this in the AbstractDoctrineExtension. As you can see, this error has something to do with the mappings you have defined in your config file.
It is also mentioned here that this error is triggered by an error in the mappings, just try to comment out what you have in the mappings.
orm:
auto_generate_proxy_classes: %kernel.debug%
default_entity_manager: default
entity_managers:
default:
mappings:
#whatever you have here