Sonata, sf2 : Undefined index: context when deleting an image from MediaBundle - php

I installed all the Bundles of Sonata following the documentation step by step. I still have few errors to fix on some actions such as deleting images. All the errors i'm facing right now seem related.
I submited two issues, one SonataMediaBundle and one in SonataClassificationBundle.
in vendor/sonata-project/media-bundle/Admin/BaseMediaAdmin.php at line
118
if ($filter = $this->getRequest()->get('filter')) {
$context = $filter['context']['value'];
} else {
$context = $this->getRequest()->get('context', $this->pool->getDefaultContext());
}
1 - DEBUG - Router Sonata\PageBundle\Route\CmsPageRouter was not able
to match, message "No site defined"
"No site defined" makes me guess i should do something on that. I did create a default page with the SonataPageBundle (added in database). I don't know if there is a specific parameter to add in the config. As i said i followed the documentation step by step and i don't see anything related to defining a site. However i'm not sure "no site defined" is related to the main error.
Here my composer.json in case it could be usefull.
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.6.",
"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": "~3.0.12",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"sonata-project/core-bundle": "~2.2#dev",
"sonata-project/notification-bundle": "~2.3",
"knplabs/knp-markdown-bundle": "~1.2",
"videlalvaro/php-amqplib": "~2.4",
"liip/monitor-bundle": "~2.0",
"symfony-cmf/routing-bundle": "1.4.#dev",
"jms/serializer-bundle": "0.13.*#dev",
"sonata-project/formatter-bundle": "~2.3",
"sonata-project/markitup-bundle": "~2.1",
"sonata-project/intl-bundle": "~2.2",
"sonata-project/cache-bundle": "~2.2",
"sonata-project/seo-bundle": "~1.1",
"sonata-project/easy-extends-bundle": "~2.1",
"sonata-project/admin-bundle": "~2.3",
"sonata-project/doctrine-orm-admin-bundle": "~2.3",
"sonata-project/user-bundle": "~2.2",
"sonata-project/classification-bundle": "dev-master",
"sonata-project/news-bundle": "dev-master",
"sonata-project/timeline-bundle": "~2.2#dev",
"sonata-project/media-bundle": "~2.4#dev",
"sonata-project/page-bundle": "~2.3#dev"
}
Any solutions or hints?

PageBundle is ignoring admin routes, so you get a notice with "No site defined" (Nothing to look more about this). I cannot reproduce the issue you state with the current dev-master code.
Please use stable version of bundles or libs.

Related

Symfony 2.8 Upgrading Packages Problem For PHP 7.0

Yesterday I updated my PHP version from 5.6 to 7.0 in a docker project using Symfony v2.8.51 where I'm now facing the issue of some of the dependencies not working.
I upgraded my packages but I am getting an error for the doctrine bundle package.
When I load the project in my browser I am getting:
Unable to load class "Doctrine\Bundle\DoctrineBundle\Registry"
in ClassCollectionLoader.php line 309
at ClassCollectionLoader::getOrderedClasses(array('Doctrine\Bundle\DoctrineBundle\Registry', 'Doctrine\Common\Annotations\DocLexer', ...
the function this error is referring to looks like this:
{
$classes = array();
foreach ($class->getInterfaces() as $interface) {
$classes = array_merge($classes, self::getInterfaces($interface));
}
if ($class->isUserDefined() && $class->isInterface() && !isset(self::$seen[$class->getName()])) {
self::$seen[$class->getName()] = true;
$classes[] = $class;
}
return $classes;
}
My composer json requirements look like this:
"php": ">=7.0",
"symfony/symfony": "^2.6.4",
"doctrine/orm": "^2.5.0",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "#stable",
"symfony/swiftmailer-bundle": "#stable",
"symfony/monolog-bundle": "3.0",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/jsrouting-bundle": "2.0.0",
"jms/serializer-bundle": "#stable",
"liuggio/excelbundle": "~2.0",
"ircmaxell/password-compat": "~1.0.3",
"stof/doctrine-extensions-bundle": "~1.1#dev",
"symfony/console": "^2.5.6",
"imagine/imagine": "#stable",
"liip/imagine-bundle": "#stable",
"soundasleep/html2text": "^0.5.0",
"snc/redis-bundle": "1.1.10",
"predis/predis": "^1.0",
"stackify/monolog": "~1.0",
"lexik/maintenance-bundle": "^2.1"
},
I’m not sure what exactly I need to do to get it to work again or what would be the best approach to upgrade all of my dependencies correctly since I don't have a lot of experience with it.

Symfony2 WebProfiler (500): Variable "app" does not exist in #Doctrine/Collector/db.html.twig at line 1

It's actually the first time for very long that I haven't found a single search result for an error message. On every page load I get a popup message saying:
"An error occurred while loading the web debug toolbar (500: Internal Server Error).
Do you want to open the profiler?" And when I open the profiler / logs:
Variable "app" does not exist in #Doctrine/Collector/db.html.twig at line 1
I made some translations and edits of twig templates - really nothing fancy. Now the profiler fails to load on every page.
my composer.json:
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.6.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.4.*",
"twig/extensions": "1.*",
"symfony/assetic-bundle": "2.3.*",
"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.*",
"incenteev/composer-parameter-handler": "~2.0",
"stof/doctrine-extensions-bundle": "~1.1#dev",
"friendsofsymfony/user-bundle": "1.3.*#dev",
"doctrine/doctrine-fixtures-bundle": "2.2.*",
"doctrine/migrations": "1.0.*#dev",
"doctrine/doctrine-migrations-bundle": "~1.0"
},
caches cleared, etc. I'm not asking for a solution but do you have any clue what the case could be here?
Thank you very much for your help & time!
Moritz
It may still be related to the cache, try to rebuild your bootstrap cache in addition to cache:clear prod & dev.
php ./vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php
PS: the path may be different in your symfony version.

Error after update symfony from 2.5.8 to 2.6

I have just update symfony 2.5.8 to 2.6 and I have this error:
SCREAM: Error suppression ignored for
( ! ) Warning: require(D:\wamp\www\agence\vendor/symfony/intl/Symfony/Component/Intl/Resources/stubs/functions.php)
[<a href='function.require'>function.require</a>]:
failed to open stream: No such file or directory in D:\wamp\www\agence\vendor\composer\autoload_real.php on line 54
and this is the composer
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.6.*",
"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",
"friendsofsymfony/user-bundle": "dev-master",
"symfony/intl": "~2.3",
"symfony/locale": "2.6.4",
"friendsofsymfony/message-bundle": "dev-master",
"stof/doctrine-extensions-bundle": "dev-master",
"gedmo/doctrine-extensions": "dev-master",
"knplabs/knp-paginator-bundle": "~2.4",
"liip/imagine-bundle": "dev-master"
},
it was working good , I don't know what happened
Remove this dependency "symfony/intl": "~2.3", this component is already included in symfony/symfony and the version constraint does not match for the desired release (2.6.*)

PHP/Assetic - You have requested a non-existent parameter "assetic.read_from"

This is a weird one. After running a $ composer update on my project, I'm suddenly getting
[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
You have requested a non-existent parameter "assetic.read_from".
errors. Checking the Symfony 2 docs, assetic.read_from is still a valid configuration setting. My current config.yml has:
assetic:
read_from: "%kernel.root_dir%/../../www/www"
write_to: "%assetic.read_from%"
Manually deleting the cache doesn't help it. I can comment out those two lines, which removes the thrown exception, but that doesn't really address the underlying issue.
Were read_from and write_to stealth removed/deprecated? Or is something else going on?
EDIT: my composer.json is:
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.6.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "2.6.*",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"jms/security-extra-bundle": "dev-master",
"jms/di-extra-bundle": "dev-master",
"friendsofsymfony/user-bundle": "2.0.*#dev",
"roave/security-advisories": "dev-master"
}

Error "Class 'Twig_SimpleFunction' not found" after upgrade to Symfony 2.2

I recently updated Symfony from 2.1 to 2.2 and now I'm getting error:
Error: Class 'Twig_SimpleFunction' not found in vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Twig/Extension/LogoutUrlExtension.php line 41
My composer.json:
...
"require": {
"php": ">=5.4",
"symfony/symfony": "2.2.*",
"twig/twig": "1.11.x",
"twig/extensions": "1.0.x-dev",
"noetix/easy-csv": "dev-master",
"symfony/assetic-bundle": "2.*",
"symfony/swiftmailer-bundle": "2.*",
"symfony/monolog-bundle": "2.*",
"sensio/distribution-bundle": "2.*",
"sensio/framework-extra-bundle": "2.*",
"sensio/generator-bundle": "2.*",
"jms/security-extra-bundle": "1.4.*",
"jms/di-extra-bundle": "1.3.*",
"jms/serializer": "0.12.*",
"jms/serializer-bundle" : "0.12.*#dev",
"jms/metadata" : "1.3.*",
"friendsofsymfony/user-bundle": "patch-1-dev",
"friendsofsymfony/jsrouting-bundle": "1.2.*",
"propel/propel1": ">=1.6.7",
"propel/propel-bundle": "1.2.x-dev",
"willdurand/propel-typehintable-behavior": "dev-master",
"pagerfanta/pagerfanta": "1.0.x-dev",
"white-october/pagerfanta-bundle": "dev-master",
"knplabs/knp-menu-bundle": "dev-master",
"knplabs/knp-menu": "2.0.x-dev",
"exercise/elastica-bundle": "dev-master",
"gregwar/captcha-bundle": "dev-master",
"nelmio/api-doc-bundle": "2.1.*",
"fr3d/ldap-bundle": "2.0.*#dev",
"conjecto/easyrdf-bundle": "dev-master"
},
...
Twig deprecated features page says: "As of Twig 1.x, use Twig_SimpleFunction". I have 1.11, so I don't get it what I'm doing wrong.
Found it. The problem was in invalid dependencies as I suspected. I downloaded Symfony2.2.11 and changed my composer.json accordingly (notice no reference to twig anymore, and changed some symfony/* and sensio/* dependencies):
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.2.*",
"twig/extensions": "1.0.*",
"noetix/easy-csv": "dev-master",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.2.*",
"symfony/monolog-bundle": "2.2.*",
"sensio/distribution-bundle": "2.2.*",
"sensio/framework-extra-bundle": "2.2.*",
"sensio/generator-bundle": "2.2.*",
"jms/security-extra-bundle": "1.4.*",
"jms/di-extra-bundle": "1.3.*",
"jms/serializer": "0.12.*",
"jms/serializer-bundle" : "0.12.*#dev",
"jms/metadata" : "1.3.*",
"friendsofsymfony/user-bundle": "patch-1-dev",
"friendsofsymfony/jsrouting-bundle": "1.2.*",
"propel/propel1": ">=1.6.7",
"propel/propel-bundle": "1.2.x-dev",
"willdurand/propel-typehintable-behavior": "dev-master",
"pagerfanta/pagerfanta": "1.0.x-dev",
"white-october/pagerfanta-bundle": "dev-master",
"knplabs/knp-menu-bundle": "dev-master",
"knplabs/knp-menu": "2.0.x-dev",
"exercise/elastica-bundle": "dev-master",
"gregwar/captcha-bundle": "dev-master",
"nelmio/api-doc-bundle": "2.1.*",
"fr3d/ldap-bundle": "2.0.*#dev",
"conjecto/easyrdf-bundle": "dev-master"
},
This installed twig 1.15 and everything works. The manual page has error - Twig_SimpleFunction appears somewhere between >1.11 and <=1.15, not in 1.x.
Twig extension classes are not namespaced. Have you checked that you haven't changed that?
Within you extension class you should use \Twig_SimpleFunction, not just Twig_SimpleFunction

Categories