FOSRest gives fatal error in symfony 2 - php

i am trying to install FOSRest & FOSRestBundle
initially , i have specified following settings in the deps
[FOSRest]
git=git://github.com/FriendsOfSymfony/FOSRest.git
target=fos/FOS/Rest
[FOSRestBundle]
git=git://github.com/FriendsOfSymfony/FOSRestBundle.git
target=bundles/FOS/RestBundle
But that cause me into following error when i access http://localhost/Symfony/web/app_dev.php/
Fatal error: Declaration of
FOS\RestBundle\Routing\Loader\RestRouteLoader::setResolver() must be
compatible with that of
Symfony\Component\Config\Loader\LoaderInterface::setResolver() in
/home/logicase/public_html/Symfony/vendor/bundles/FOS/RestBundle/Routing/Loader/RestRouteLoader.php
on line 29
After that i tried following setting to make to the master branch and above error remains the same
[FOSRest]
git=git://github.com/FriendsOfSymfony/FOSRest.git
target=fos/FOS/Rest
version=origin/2.0
[FOSRestBundle]
git=git://github.com/FriendsOfSymfony/FOSRestBundle.git
target=bundles/FOS/RestBundle
version=origin/2.0
and now when i run php ./bin/vendors install
i get following message in console.
Installing/Updating FOSRest 5eb800bd63ba84e5fc7028386cb66373bc3efafc fatal: ambiguous argument 'origin/2.0': unknown revision or path not
in the working tree. Use '--' to separate paths from revisions
Installing/Updating FOSRestBundle c11ab9d990a1e0e979b1c8ab72cc9793b4b2dcb5 fatal: ambiguous argument
'origin/2.0': unknown revision or path not in the working tree.

I tried following settings for FOSRest which solved my problem for symfony 2
[FOSRest]
git=git://github.com/FriendsOfSymfony/FOSRest.git
target=fos/FOS/Rest
version=origin/0.6
[FOSRestBundle]
git=git://github.com/FriendsOfSymfony/FOSRestBundle.git
target=bundles/FOS/RestBundle

As you can see, there is no 2.0 branch : https://github.com/FriendsOfSymfony/FOSRestBundle/branches https://github.com/FriendsOfSymfony/FOSRest/branches The installation documentation does not talk about it. You should just remove the version lines.

Related

Symfony is suddenly failing with "The service "session.storage.metadata_bag" has a dependency on a non-existent parameter"

I upgraded from Symfony 3.1.5 to 3.2.0 yesterday morning and everything was fine up until an hour or so ago.
Now Symfony throws the following exception upon any type of access, including console commands:
[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
The service "session.storage.metadata_bag" has a dependency on a
non-existent parameter "session.metadata.storage_key".
I have tried the following:
Backed out my most recent changes
Deleted var/cache/*
Here is the exception trace:
Exception trace:
() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:100
Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->get() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php:56
Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag->get() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:217
Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->resolveString() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:187
Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->resolveValue() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:177
Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->resolveValue() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php:39
Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass->process() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:120
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:565
Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:484
Symfony\Component\HttpKernel\Kernel->initializeContainer() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:116
Symfony\Component\HttpKernel\Kernel->boot() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:68
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:122
Symfony\Component\Console\Application->run() at /Volumes/Data01/Projects/Beck/WWUI/site/bin/console:29
As you can see, it's part of Symfony, and not my code.
I am at a loss.
Has anybody else seen this?
Suggestions?
Edit 1:
Based on Dagon's suggestion that I check session.xml, and seeing that it appears correct, I decided to replace the
<argument>%session.metadata.storage_key%</argument>
tag with
<argument>_sf2_meta</argument>
in session.xml. This resulted in a new, similar error:
[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
The service
"64e3c91c625381e3c2c0184cf9ea0c6d5353986d77aa111949ca6fb8b17a8f07_2"
has a dependency on a non-existent parameter "validator.mapping.
cache.prefix".
This isn't really an answer per-se, but is is a fix.
I renamed vendor to vendor-HOLD and then ran composer install. Problem gone.
I did a diff on the old and new session.xml files and found that the definition of the parameter was different. The version causing the error contained:
<parameter string="session.metadata.storage_key">_sf2_meta</parameter>
The newly installed version contained:
<parameter key="session.metadata.storage_key">_sf2_meta</parameter>
instead. Obviously other files were incorrect, as well, based on the experimental edit I did to session.xml. No clue as to what happened, but it's nice that composer install fixed it. Oh, and yes, I deleted vendor-HOLD afterwards.

Symfony2 Memcached - LeaseWeb/LswMemcacheBundle Not work in development mode

Am using Symfony2 in my project and i added this bundle "LeaseWeb/LswMemcacheBundle" to use memcahced , the problem that its work fine for me in the production mode and in development mode show me this error :
ContextErrorException: Catchable Fatal Error: Argument 3 passed to
Lsw\MemcacheBundle\DataCollector\MemcacheDataCollector::addClient()
must be an instance of
Lsw\MemcacheBundle\Cache\LoggingMemcacheInterface, instance of
Lsw\MemcacheBundle\Cache\AntiDogPileMemcache given, called in
/home/www/project/app/cache/dev/appDevDebugProjectContainer.php on
line 2166 and defined in
/home/www/project/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/DataCollector/MemcacheDataCollector.php
line 40
And here is my configuration :
lsw_memcache:
session:
client: default
clients:
default:
hosts:
- { dsn: localhost, port: 11211 }
Any one can help with this ?
Thank you in advance ...
I cant see any problem with your configuration.
The error message should not occur with the current version of the bundle.
Which Version of the bundle do you use?
This is a reported issue in the symfony bundle, until now is not fixed
https://github.com/LeaseWeb/LswMemcacheBundle/issues/41
This is solved, its was need libmemcache version 1.0.10 or higher and install last version of memcahced .

How to install twig localizeddate filter?

I have PHP 5.5.9 and I activated php_intl.dll exyention and set its configuration in the active php.ini as the following:
[intl]
intl.default_locale = ar
; This directive allows you to produce PHP errors when some error
; happens within intl functions. The value is the level of the error produced.
; Default is 0, which does not produce any errors.
;intl.error_level = E_WARNING
When I try the following twig code:
{{ item.get_date('j F Y | g:i a')|localizeddate('medium', 'none', locale) }}
I got a fatal error:
Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'The filter "localizeddate" does not exist in "index.html" at line 53'
in
The official documentation there does not show how to install or add this filter to twig. I use simple PHP application without Symfony. The twig version 1.16.0
You're looking for the twig/extensions composer package, the github repo is at fabpot/Twig-extensions.
You mention you're using twig standalone, then you must have a Twig_Environment object. It has an addExtension method, you need to call it, passing a new instance of the Intl extension:
$env->addExtension(new Twig_Extensions_Extension_Intl());

Integrate OSExcelBundle

I tried to install OSExcelBundle (https://github.com/ouardisoft/OSExcelBundle) on Symfony 2.1 by following the README :
Add this line to the require option in your composer.json file: "os/excel-bundle": "dev-master"
OK
Add autoloader for PHPExcel in app/autoloader.php : require __DIR__.'/../vendor/os/php-excel/PHPExcel/PHPExcel.php'; There is no app/autoloader.php in symfony 2.1 - I tried to add the line in app/autoload.php - without success.
This works : php composer.phar install
But without step 2 this does not work : I get this error message :
You have requested a non-existent service "os.excel"
If someone can give me a hint would be nice ...
Edit :
I added this line in AppKernel : new OS\ExcelBundle\OSExcelBundle(),
and so the bundle seems to be taken in account.
Nevertheless now I get this error :
Fatal error: Class 'PHPExcel_IOFactory' not found in ..\vendor\os\excel-bundle\OS\ExcelBundle\Excel\Excel.php on line 29
So I really need to know where I can declare PHPExcel !
I installed an other bundle : ExcelBundle
This one no problem to install (???)
And !!! : it resolves my problem with the other bundle - because it made PHPExcel available
So I can go on ...

Getting 'CG\Proxy\InterceptorLoaderInterface' error with JMS Bundle in symfony 2

I am trying to install symfony2 JMS DI Extra bundle.
But i keep getting this error
Fatal error: Interface 'CG\Proxy\InterceptorLoaderInterface' not found
in
/home/xxxxx/public_html/XXXX/Symfony/vendor/bundles/JMS/AopBundle/Aop/InterceptorLoader.php
on line 30
I have found the solution here
https://github.com/schmittjoh/JMSAopBundle/issues/7
But could not able to understand where to fix the path
I think that's cg-library is missing. Open a command prompt into your Symfony vendor folder and issue:
git clone https://github.com/schmittjoh/cg-library.git cg-library
The add cg-library into your deps file:
[cg-library]
git=https://github.com/schmittjoh/cg-library.git
target=/cg-library

Categories