Install Sonata Dashboard bundle - php

I want to install Sonata Dashboard bundle, so I follow these steps.
After installing and configuring I get an error:
Compile Error: Declaration of Application\Sonata\DashboardBundle\Entity\Dashboard::getId() must be compatible with Sonata\DashboardBundle\Model\Dashboard::getId(): ?int
I use Symfony 3.4, php 7.2 and composer.json looks like:
"require": {
"php": ">=5.5.9",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"enqueue/amqp-lib": "^0.8.23",
"friendsofsymfony/rest-bundle": "^2.3",
"friendsofsymfony/user-bundle": "^2.1",
"incenteev/composer-parameter-handler": "^2.0",
"jms/serializer-bundle": "^2.3",
"liip/monitor-bundle": "^2.6",
"nelmio/api-doc-bundle": "^3.2",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^5.0.0",
"sonata-project/admin-bundle": "^3.34",
"sonata-project/block-bundle": "^3.12",
"sonata-project/cache": "1.x-dev",
"sonata-project/cache-bundle": "2.4",
"sonata-project/classification-bundle": "^3.6",
"sonata-project/core-bundle": "^3.9",
"sonata-project/dashboard-bundle": "^0.3.0",
"sonata-project/datagrid-bundle": "2.3",
"sonata-project/doctrine-extensions": "^1.0",
"sonata-project/doctrine-orm-admin-bundle": "^3.5",
"sonata-project/easy-extends-bundle": "^2.5",
"sonata-project/formatter-bundle": "^3.4",
"sonata-project/google-authenticator": "^2.1",
"sonata-project/media-bundle": "^3.12",
"sonata-project/news-bundle": "3.4",
"sonata-project/notification-bundle": "^3.5",
"sonata-project/seo-bundle": "^2.5",
"sonata-project/user-bundle": "^4.1",
"symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/swiftmailer-bundle": "^2.6.4",
"symfony/symfony": "3.4.*",
"symfony/templating": "3.4.8",
"twig/twig": "^1.0||^2.0"
},
Any ideas what can be wrong?

Looks like the generated entity misses the return type hints… probably a bug in Sonata Easy Extends bundle. You can add type hint by finding and modifying Application\Sonata\DashboardBundle\Entity\Dashboard

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.

Error: Class 'PHPUnit_Util_ErrorHandler' not found

this is the relevant composer.jpon config.
"require": {
"php": ">=5.5.9",
"twig/twig": "^2.0",
"symfony/symfony": "3.2.*",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "~2.11.3",
"symfony/polyfill-apcu": "^1.0",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0",
"friendsofsymfony/user-bundle": "dev-master",
"knplabs/knp-paginator-bundle": "^2.5",
"symfony/assetic-bundle": "^2.7",
"vich/uploader-bundle": "dev-master",
"twbs/bootstrap": "^3.3",
"components/jquery": "^2.1",
"twig/extensions": "^1.3",
"phpunit/phpunit": "^6.0"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
"doctrine/doctrine-fixtures-bundle": "^2.3",
"phpunit/dbunit": "^3.0",
"symfony/phpunit-bridge": "^3.0"
},
When i execute php phpunit the following appears:
Time: 1.01 seconds, Memory: 20.00MB
There was 1 error:
1) UserBundle\Tests\Unit\ScaleUserServiceTest::testIsUsersEmpty
Error: Class 'PHPUnit_Util_ErrorHandler' not found
Can someone help me what to do?
Thanks in advance,
Max
You are installing PHPUnit 6. That version does not have PHPUnit_Util_ErrorHandler anymore.
Information on migrating to PHPUnit 6 can be found here, the complete list of changes in PHPUnit 6 is available here.

Need help to clean/organize sonata-project dependencies in composer

I'm using the great sonata admin bundle on my projects.
But for a few months, I got problems with the dependencies when updating using composer. I needed to change version declaration, but it keeps giving me errors.
I took a look on the sonata doc but it gives no help on versions.
So I'm asking here if someone could give me the correct configuration in the composer file to get all of sonata bundle working together.
Here is my composer.json
"php": ">=5.3.3",
"symfony/symfony": "2.3.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.2.*",
"twig/extensions": "1.0.*",
"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",
"friendsofsymfony/user-bundle": "1.3.*",
"sonata-project/admin-bundle": "2.2.*#dev",
"sonata-project/block-bundle": "2.1.*#dev",
"sonata-project/cache-bundle": "dev-master",
"sonata-project/jquery-bundle": "1.8.*#dev",
"sonata-project/easy-extends-bundle" : "dev-master",
"sonata-project/intl-bundle" : "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "dev-master",
"sonata-project/user-bundle": "dev-master",
"sonata-project/media-bundle" : "dev-master",
"genemu/form-bundle": "2.2.*",
"winzou/console-bundle": "1.*",
"knplabs/knp-menu-bundle": "~2.0#dev",
"knplabs/knp-menu": "~2.0#dev"
My Symfony version is 2.3.8
Thanks in advance.
Here is working composer configuration for sonata bundles and Symfony 2.3.9:
{
"sonata-project/admin-bundle": "dev-master",
"sonata-project/core-bundle": "~2.2#dev",
"sonata-project/doctrine-orm-admin-bundle": "dev-master",
"sonata-project/intl-bundle": "dev-master",
"sonata-project/cache-bundle": "dev-master",
"sonata-project/cache": "~1.0#dev",
"sonata-project/block-bundle": "#dev",
"sonata-project/jquery-bundle": "#dev",
"sonata-project/doctrine-extensions": "1.0.0",
"sonata-project/user-bundle": "dev-master",
"sonata-project/easy-extends-bundle": "dev-master",
"sonata-project/exporter": "1.3.*"
}

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

Composer install failing

I was given a project to work on, and to get it set up I am trying to use composer install to get all my dependencies install and working. The issue is when I try to run composer install, I get the following errors:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package sylius/sales-bundle 0.1.x-dev could not be found.
Problem 2
- Installation request for sylius/cart-bundle dev-master -> satisfiable by sylius/cart-bundle[dev-master].
- Can only install one of: sylius/resource-bundle[v0.3.0, v0.1.0].
- sylius/cart-bundle dev-master requires sylius/resource-bundle 0.3.* -> satisfiable by sylius/resource-bundle[v0.3.0].
- Installation request for sylius/resource-bundle 0.1.*#dev -> satisfiable by sylius/resource-bundle[v0.1.0].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
The composer.json file looks like this:
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.0.*",
"twig/twig": "dev-master",
"twig/extensions": "1.0.*#dev",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.1.*",
"symfony/monolog-bundle": "2.1.*",
"symfony/dom-crawler": "2.1.*#dev",
"liip/doctrine-cache-bundle": "dev-master",
"sensio/distribution-bundle": "2.1.*",
"sensio/framework-extra-bundle": "2.1.*",
"sensio/generator-bundle": "2.1.*",
"kriswallsmith/assetic": "1.1.*#dev",
"apy/datagrid-bundle": "2.1.*#dev",
"bcc/cron-manager-bundle": "dev-master",
"craue/formflow-bundle": "dev-master",
"craue/config-bundle": "dev-master",
"ddeboer/data-import": "dev-master",
"phpexcel/phpexcel": "1.7.6",
"doctrine/migrations": "dev-master",
"doctrine/doctrine-migrations-bundle": "dev-master",
"elnur/blowfish-password-encoder-bundle": "dev-master",
"friendsofsymfony/user-bundle": "1.3.1",
"friendsofsymfony/message-bundle": "dev-master",
"friendsofsymfony/rest": "0.8.*#dev",
"friendsofsymfony/rest-bundle": "0.11.*#dev",
"friendsofsymfony/comment-bundle": "2.0.*#dev",
"friendsofsymfony/jsrouting-bundle": "1.1.*",
"frosas/base-url-bundle": "1.*#dev",
"genemu/form-bundle": "2.1.*",
"jms/serializer": "0.11.*#dev",
"jms/serializer-bundle": "0.11.*",
"jms/di-extra-bundle": "1.3.*#dev",
"jms/debugging-bundle": "dev-master",
"jms/job-queue-bundle": "dev-master",
"jms/payment-core-bundle": "dev-master",
"jms/security-extra-bundle": "1.4.*#dev",
"jms/twig-js": "dev-master",
"jms/twig-js-bundle": "dev-master",
"knplabs/gaufrette": "0.2.*#dev",
"knplabs/knp-gaufrette-bundle" : "dev-master",
"knplabs/knp-menu": "#dev",
"knplabs/knp-menu-bundle": "1.1.*#dev",
"knplabs/knp-snappy-bundle": "dev-master",
"knplabs/knp-time-bundle": "dev-master",
"lexik/mailer-bundle": "dev-master",
"lexik/maintenance-bundle": "dev-master",
"lexik/form-filter-bundle": "dev-master",
"pugx/multi-user-bundle": "1.3.x-dev",
"Trsteel/ckeditor-bundle": "dev-master",
"velvel/report-bundle": "dev-master",
"sonata-project/cache-bundle": "dev-master",
"sonata-project/admin-bundle": "2.1.x-dev",
"sonata-project/doctrine-orm-admin-bundle": "2.1.x-dev",
"sonata-project/jquery-bundle": "1.8.*#dev",
"sonata-project/exporter": "1.1.0",
"sonata-project/block-bundle": "2.1.x-dev",
"sonata-project/intl-bundle": "2.1.x-dev",
"sonata-project/user-bundle": "2.1.x-dev",
"sonata-project/doctrine-extensions": "1.0.0",
"sonata-project/easy-extends-bundle": "dev-master",
"sonata-project/google-authenticator": "1.0.0",
"stof/doctrine-extensions-bundle": "1.1.x-dev",
"sylius/blogger-bundle": "0.1.x-dev",
"sylius/cart-bundle": "dev-master",
"sylius/categorizer-bundle": "dev-master",
"sylius/resource-bundle": "0.1.*#dev",
"sylius/sales-bundle": "0.1.x-dev",
"white-october/pagerfanta-bundle": "2.1.x-dev as dev-master",
"pagerfanta/pagerfanta": "1.0.*#dev",
"oneup/uploader-bundle": "*",
"whiteoctober/breadcrumbs-bundle": "dev-master",
"raulfraile/ladybug-bundle": "*",
"nelmio/js-logger-bundle": "~1.0",
"nelmio/security-bundle": "~1.0",
"mtdowling/cron-expression": "1.0.x",
"liip/imagine-bundle": "dev-master",
"elao/web-profiler-extra-bundle" : "2.1.*#dev",
"elink/payment-slimcd-bundle": "2.1.*#dev",
"punkave/symfony2-file-uploader-bundle": "dev-master",
"leek/git-debug-bundle": "2.0.*#dev"
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
The project is using Symfony as a framework, and everytime I think I have a fix, it causes other issues. I have been banging my head for over an hour trying to get this sorted out.
you should replace your line including sales-bundle by :
"sylius/sales-bundle": "0.2.*#dev"
check the packagist website and enter the name of your bundles when you have problems. It will show you dependencies between bundles and what are the versions.

Categories