I'll be brief:
I have a TYPO3 with composer installed.
Let us have a look at the require part from TYPO3.
"require": {
"php": ">=5.5.0",
"ext-fileinfo": "*",
"ext-json": "*",
"ext-pcre": "*",
"ext-session": "*",
"ext-xml": "*",
"psr/log": "1.0.*#dev",
"pear/http_request2": "~2.2.1",
"swiftmailer/swiftmailer": "~5.4.1",
"symfony/console": "~2.7.0",
"symfony/finder": "~2.7.0",
"doctrine/instantiator": "~1.0.4",
"typo3/class-alias-loader": "^1.0",
"typo3/cms-composer-installers": "^1.2.8",
"psr/http-message": "~1.0",
"cogpowered/finediff": "~0.3.1",
"mso/idna-convert": "^0.9.1"
}
As you can see TYPO3 needs "symfony/console": "~2.7.0" so that means: (>=2.7 <= 2.8)
Next to it I run a CakePHP with the migrations plugin for the custom CakePHP Part.
Let's have a look at the require part from the database migration plugin as well:
"require": {
"php": ">=5.4",
"robmorgan/phinx": "0.5.3",
"cakephp/cakephp": "~3.1"
},
Nothing wrong here on the first look, but let us go in detail and have a closer look at "robmorgan/phinx": "0.5.3". This Plugin needs the following packages, and again let's have a closer look at the composer.json from "phinx".
"require": {
"php": ">=5.4",
"symfony/console": "~2.8|~3.0",
"symfony/config": "~2.8|~3.0",
"symfony/yaml": "~2.8|~3.0"
}
And now as you can see this package needs "symfony/console" at least in 2.8, but it doesn't work because TYPO3 needs it in "~2.7.0" that means: (>=2.7 <= 2.8).
I figured out the issue, but I have no idea how to solve it. I only have one solution but it is not that great, it's forking TYPO3 and editing the composer.json. But that is the very last option.
Does anyone else have a good approach on how to fix this?
You can use version 8.x of TYPO3. This version uses as requirement "symfony/console": ">=2.7 <3.1",which looks absolutly fine then.
8.x is very stable, you can use doctrine all over the place and it is the future.
Related
I've read the current docs on Symfony integration with Monolog, but all it says is to run:
composer require logger which throws an error "package not found". (https://symfony.com/doc/current/logging.html#installation)
I'm using these components:
"require": {
"symfony/dependency-injection": "~3.0",
"symfony/yaml": "~3.0",
"symfony/config": "~3.0",
"symfony/console": "~3.0",
"symfony/validator": "~3.0",
"symfony/event-dispatcher": "~3.0",
"guzzlehttp/guzzle": "~6.0",
"gedex/janrain-api": "~0.1"
},
"require-dev": {
"phpunit/phpunit": "~5.7",
"friendsofphp/php-cs-fixer": "~2.0",
"squizlabs/php_codesniffer": "~3.0",
"symfony/var-dumper": "~3.0"
},
I want to do logging using dependency injection and config module.
EDIT: it is not a web application. It is a library that provides abstraction and exposes internal API, and I want to make it possible to log what is going on in the methods.
Looking at your composer.json, you seem to be on Symfony 3.x still. The docs for your version are at https://symfony.com/doc/3.4/logging.html.
The composer require logger is a shortcut which works with Flex. Flex is default on Symfony 4, but optional for Symfony 3. If you’ve upgraded from an earlier version, I assume that you currently don’t use Flex. In this case, you can install monolog and its Symfony integration by running:
composer require "symfony/monolog-bundle": "^3.1.0"
Then you must add the monolog bundle to your AppKernel:
$bundles = [
…
new Symfony\Bundle\MonologBundle\MonologBundle(),
…
];
Then you can inject the #logger service into your own services or call it in your controllers.
I have a conflict / problem between sonate admin and media bundle.
Here is the error :
Runtime Notice: Declaration of Sonata\MediaBundle\Controller\MediaAdminController::render() should be compatible with Sonata\AdminBundle\Controller\CRUDController::render($view, array $parameters = Array, Symfony\Component\HttpFoundation\Response $response = NULL, Symfony\Component\HttpFoundation\Request $request = NULL)
The error happen while in the backend I try to interact with the media control panel (automaticaly added by the media bundle).
The only mention of this error on google is talking about dependencies issues.
https://github.com/sonata-project/SonataMediaBundle/issues/731
Here is the composer.json
"sonata-project/admin-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "^2.3",
"sonata-project/media-bundle": "^2.3"
If to change for "sonata-project/media-bundle": "dev-master" it's also not working
The service "sonata.media.admin.media" has a dependency on a non-existent service "sonata.classification.manager.category".
and anyway I'm not sure I want to use 'dev' packages.
Is this Sonata project still working ? the doc is outdated
I'm extremly tired of these sonata bundles - seems like a good idea but it's so time consuming to configure them properly ...
So here is the trick :
in your composer.json you need to use the following version :
"sonata-project/admin-bundle": "^2.3",
"sonata-project/doctrine-orm-admin-bundle": "^2.3"
"require-dev": {
"sensio/generator-bundle": "~2.3", <== CHANGE THIS !!!
},
in the require-dev you need to change "sensio/generator-bundle": "3.0" to "sensio/generator-bundle": "~2.3"
This doesn't solve the original issue, but will make sonata admin / media working together.
thx to chalasr for helping.
Current composer
"require": {
"php": ">=5.5",
"other/bundle": "~1.0"
},
When some use other/bundle on dev-develop or another branch he can't install my bundle. How I can allow this?
This is what stability flags are for.
"require": {
"php": ">=5.5",
"other/bundle": "~1.0#dev"
},
I am doing a i18n testing on symfony2. (v2.4) . And i follow the steps http://symfony.com/doc/master/book/translation.html.
Just like another guys' question Symfony Basic Translation Example, Exception i came across a exception "The "xlf" translation loader is not registered".
my config detail like this:
app/config/config.yml
translator: { fallback: "%locale%" } // locale=en
src/xxx/MyBundle/Controller/DefaultController.php
/**
*#Route("/tr")
*/
public function trAction()
{
$translated = $this->get('translator')->trans('symfony.test.great');
return new Response($translated);
}
src/xxx/MyBundle/Resources/translations/messages.en.xlf (or with suffix “xliff”)
.....
<trans-unit id="10">
<source>symfony.test.great</source>
<target> Symfony is Great...</target>
</trans-unit>
....
When i visit the router /tr, it says:
The "xlf" translation loader is not registered. 500 Internal Server
Error - RuntimeException
Any wrong point? please give me a hand ,thanks in advance.
And more:
my compose.json :
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "~2.2,>=2.2.3",
"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": "~2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
"sonata-project/admin-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "dev-master",
"sonata-project/intl-bundle": "dev-master",
"friendsofsymfony/elastica-bundle": "3.0.x",
"symfony/translation": "2.4.x-dev",
"symfony/config": "2.4.x",
},
Thanks everybody.
I now can fix the issues by this: (add loader manually)
in my Controller / action:
/**
*#Route("/tr")
*/
public function trAction()
{
$tr = $this->get('translator');//->trans('symfony.test.great');
$tr->addLoader('xliff', new XliffFileLoader()); // new add
$tr->addLoader('xlf', new XliffFileLoader()); // new add
$translated = $tr->trans('symfony.test.great');
return new Response($translated);
}
I don't know why must to add this. And the symfony document "http://symfony.com/doc/master/book/translation.html" also don't add that. Any suggest will be welcome. Thanks again.
I know this is an old question but still someone might find it useful. Had the same problem which I solved by removing some packaged from composer.json
Remove these packages:
"symfony/translation": "2.3.*",
"symfony/config": "2.3.*"
then run composer update
Symfony has built in translation so you don't need to add anything extra but still if you want or need to use them you probably need to add the extension to your twig environment. more info read the docummentation
I fixed a similar problem like this:
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\Loader\XliffFileLoader;
...
...
$translator = new Translator('en_US');
$translator->addLoader('xlf', new XliffFileLoader());
$translator->addResource('xlf', __DIR__ . '/registration.xlf', 'it_IT', 'registration');
The loaders are configured in ./vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml
You should have the following parameter:
<parameter key="translation.loader.xliff.class">Symfony\Component\Translation\Loader\XliffFileLoader</parameter>
If everything looks ok, use xliff extension, check that your the file header looks something like this:
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
and clear the cache.
I know this is an old question but I just found the correct answer:
Search on your translation folder a file with the extension .xlf~ and delete it.
For example:
messages.en.xlf~
These files are created by the translation:update console command.
I am trying to follow the tutorial ## but am running into an issue.
I am receiving the following exception:
Call to undefined method Symfony\Component\Config\Definition\Builder\NodeBuilder::fixXmlConfig() in DIR\vendor\jms\serializer-bundle\JMS\SerializerBundle\DependencyInjection\Configuration.php line 46
Does anyone know what is going on?
I have enabled both required bundles:
new JMS\SerializerBundle\JMSSerializerBundle($this),
new FOS\RestBundle\FOSRestBundle(),
I'm guessing that one of the bundles is not updated to 2.3 as of yet maybe?
If you use the dev-master branch for both dependencies you can get it up and running.
composer.json
"require": {
...
"friendsofsymfony/rest-bundle": "0.12.0",
"jms/serializer-bundle": "dev-master",
"jms/di-extra-bundle": "dev-master"
},
AppKernel.php
new JMS\SerializerBundle\JMSSerializerBundle($this),
new FOS\RestBundle\FOSRestBundle(),
This seems to have sorted it for me.