I recently came across Sanota Project and wanted to give it a try. I am trying to install all the bundles of sanota project following the quick installation steps mentioned here
and when I run the website php app/console server:run all i see is the white screen. I dont see any error in app_dev.log
I cross checked if the bundles are enabled in Appkernel.php and they seem to be.
public function registerBundles()
{
$bundles = array(
// SYMFONY STANDARD EDITION
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\AopBundle\JMSAopBundle(),
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
// DOCTRINE
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
// KNP HELPER BUNDLES
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
// USER
new FOS\UserBundle\FOSUserBundle(),
new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
new Application\Sonata\UserBundle\ApplicationSonataUserBundle(),
// PAGE
new Sonata\PageBundle\SonataPageBundle(),
new Application\Sonata\PageBundle\ApplicationSonataPageBundle(),
// NEWS
new Sonata\NewsBundle\SonataNewsBundle(),
new Application\Sonata\NewsBundle\ApplicationSonataNewsBundle(),
// MEDIA
new Sonata\MediaBundle\SonataMediaBundle(),
new Application\Sonata\MediaBundle\ApplicationSonataMediaBundle(),
// new Liip\ImagineBundle\LiipImagineBundle(),
new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
// Disable this if you don't want the audit on entities
new SimpleThings\EntityAudit\SimpleThingsEntityAuditBundle(),
// API
new FOS\RestBundle\FOSRestBundle(),
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
// E-COMMERCE
new Sonata\BasketBundle\SonataBasketBundle(),
new Application\Sonata\BasketBundle\ApplicationSonataBasketBundle(),
new Sonata\CustomerBundle\SonataCustomerBundle(),
new Application\Sonata\CustomerBundle\ApplicationSonataCustomerBundle(),
new Sonata\DeliveryBundle\SonataDeliveryBundle(),
new Application\Sonata\DeliveryBundle\ApplicationSonataDeliveryBundle(),
new Sonata\InvoiceBundle\SonataInvoiceBundle(),
new Application\Sonata\InvoiceBundle\ApplicationSonataInvoiceBundle(),
new Sonata\OrderBundle\SonataOrderBundle(),
new Application\Sonata\OrderBundle\ApplicationSonataOrderBundle(),
new Sonata\PaymentBundle\SonataPaymentBundle(),
new Application\Sonata\PaymentBundle\ApplicationSonataPaymentBundle(),
new Sonata\ProductBundle\SonataProductBundle(),
new Application\Sonata\ProductBundle\ApplicationSonataProductBundle(),
new Sonata\PriceBundle\SonataPriceBundle(),
new JMS\SerializerBundle\JMSSerializerBundle($this),
new FOS\CommentBundle\FOSCommentBundle(),
new Sonata\CommentBundle\SonataCommentBundle(),
new Application\Sonata\CommentBundle\ApplicationSonataCommentBundle(),
// SONATA CORE & HELPER BUNDLES
new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\IntlBundle\SonataIntlBundle(),
new Sonata\FormatterBundle\SonataFormatterBundle(),
new Sonata\CacheBundle\SonataCacheBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Sonata\SeoBundle\SonataSeoBundle(),
new Sonata\ClassificationBundle\SonataClassificationBundle(),
new Application\Sonata\ClassificationBundle\ApplicationSonataClassificationBundle(),
new Sonata\NotificationBundle\SonataNotificationBundle(),
new Application\Sonata\NotificationBundle\ApplicationSonataNotificationBundle(),
new Application\Sonata\SeoBundle\ApplicationSonataSeoBundle(),
new Sonata\DatagridBundle\SonataDatagridBundle(),
// Search Integration
//new FOS\ElasticaBundle\FOSElasticaBundle(),
// CMF Integration
new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
// DEMO and QA - Can be deleted
new Sonata\Bundle\DemoBundle\SonataDemoBundle(),
new Sonata\Bundle\QABundle\SonataQABundle(),
// Disable this if you don't want the timeline in the admin
new Spy\TimelineBundle\SpyTimelineBundle(),
new Sonata\TimelineBundle\SonataTimelineBundle(),
new Application\Sonata\TimelineBundle\ApplicationSonataTimelineBundle(), // easy extends integration
new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle()
);
No matter what route i access
/blog
/page
/media
/admin
All i see is white screen and no error in app_dev.log.
I am using Ubuntu with xampp, all other symfony projects are working fine, except this Sonata Project. My xampp logs also do not mention any error that could be causing this. In fact i cleared my log files so only Sonata related errors are logged if any and at the moments all log files are empty too.
While trying to install using composer
composer create-project sonata-project/sandbox:dev-2.4-develop
or
composer create-project sonata-project/sandbox:dev-2.3-develop
or
composer create-project sonata-project/sandbox:2.3.x-dev
I get the following error
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for doctrine/doctrine-migrations-bundle ~2.0#dev -> satisfiable by doctrine/doctrine-migrations-bundle[2.0.x-dev].
- doctrine/doctrine-migrations-bundle 2.0.x-dev requires symfony/symfony >=2.0,<2.1 -> 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 minimum-stability setting
see for more details.
Read for further common problems.
I followed these instructions as well but no luck.
Since this is my first time with Sonata so I might be doing something wrong. I will really appreciate any help on this.
You have to change in file composer.json, line 34 to:
"doctrine/doctrine-migrations-bundle": "1.0.*",
After that enter this command in sandbox folder:
composer update
The minimum-stability of the project you try to install is set to a option higher than dev. So composer will not be able to install this project.
First try to install a stable version of the project, and try to upgrade to a dev version afterwards by changing the minimum-stability to dev.
composer create-project sonata-project/sandbox
I'd advise you to also set prefer-stable to true, so the other packages will not all switch to the dev-master branch.
Related
given is my appKernel class while registering the bundles it is sing to generate the classes
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle(),
new Nelmio\CorsBundle\NelmioCorsBundle(),
but i used following commands to generate them from composer
composer require friendsofsymfony/rest-bundle
composer require jms/serializer-bundle
composer require nelmio/cors-bundle
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle(),
new Nelmio\CorsBundle\NelmioCorsBundle(),
];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
while running my php code it is giving exceptions because given bundles are not register
run the command and clear cache:
php bin/console cache:clear
also add the use classes at top AppKernel.php
There will also be some configuration for them all in a config file. Often in app/config/config.yml. Even if it will all be the default, they need to be fully enabled by that entry in the configuration (yml, or xml).
You can see the sample (and complete, with all defaults) with the command bin/console debug:config JMSSerializerBundle, replacing the bundle-name as appropriate.
There is a page of details for JMSSerializer and similar exist for the others.
I have gone through many questions related to this in SO, but couldn't find a solution to my problem.
I have copied the demo symfony application to /var/www/html/myproject folder. I can only access the localhost/myproject/web/app_dev.php but not localhost/myproject/web/app.php . Basically I want to switch from development environment to prodution environment.
I just get a blank page when I access app.php. How do I solve this issue?
Following is my routing.yml file
app:
resource: "#AppBundle/Controller/"
type: annotation
EDIT
Error log (app/logs/prod.log)
[2015-04-06 22:54:53] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /"" at /home/fazlan/ppp/myproject/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php line 144 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /\" at /home/fazlan/ppp/myproject/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php:144, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): at /home/fazlan/ppp/myproject/app/cache/prod/appProdUrlMatcher.php:35)"} []
You need to create your bundle and configure routes for it. After this prod environment will be work. It is possible that the acme isnt work in prod.
#Cedric: Acme Demo Bundle is only configured on app_dev.php you have to create another bundle first with proper routes, you can see the list of routes for your bundle in app/config/routing.yml or whatever you set as a the extension of your configs.
More info here.
After going through different tutorials and manuals, I finally was able to solve this issue by the following changes.
routing.yml
app:
resource: "#AppBundle/Controller/"
type: annotation
_acme_demo:
resource: "#AcmeDemoBundle/Resources/config/routing.yml"
AppKernel.php (The whole file is not shown here)
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new Acme\DemoBundle\AcmeDemoBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
//$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
in the above file AcmeDemoBundle is registered. You have to comment out //$bundles[] = new Acme\DemoBundle\AcmeDemoBundle(); to prevent the bundle being registered twice in dev and test environments.
After editing those two files go to the project folder and do
php app/console --env=prod cache:clear
and then in the browser localhost/myproject/web/app.php would load the same bundle as in app_dev.php
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\I18nRoutingBundle\JMSI18nRoutingBundle(),
new JMS\TranslationBundle\JMSTranslationBundle(),
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
new Maxmind\Bundle\GeoipBundle\MaxmindGeoipBundle(),
new FOS\UserBundle\FOSUserBundle(),
new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(),
new Vich\UploaderBundle\VichUploaderBundle(),
new JMS\DiExtraBundle\JMSDiExtraBundle($this),
new JMS\AopBundle\JMSAopBundle(),
new Knp\Bundle\SnappyBundle\KnpSnappyBundle(),
new Sonata\IntlBundle\SonataIntlBundle(),
);
please let me know why is happened?.... we need to update composer?
it seems like there's a problem with the namespace?
It looks like it's a composer problem since the bundle declaration is already namespaced and I'm assuming you haven't monkied with how the AppKernel sets up it's autoloader.
Either you need to add the library to composer:
composer require vich/uploader-bundle:0.14.0
or if you've manually updated composer.json, you'll need to run:
composer update --lock
Which will install the dependency, update the lockfile, and re-generate your autoload.php file. These commands may or may not work depending on how you installed composer(may need to prepend commands with php composer.phar instead of composer). You'll need to figure that out for yourself. Also, you'll need to specify the version you want as well. I just chose the latest stable from packagist.
My Internet conexion is useless to install a symphony 2 dependency with composer as far as I can say. Is there a way to install a third party bundle manually? I have been looking in Google and I did not find any useful thing so far. About my connection issue, I started this thread to try and find a solution to install within this connection. here I am trying to find clues to a solution to install manually.
Regards
1 Create under vendor directory the path for bundle :
/*like mycompany*/ /*like product-bundle*/ /*like MyCompany*/
vendor/yourbundlenamespace/your-bundle-name-bundle/YourBundleNameSpace/
2 Go to in the new path and put the content of budle (or clone from github).
3* #deprecated
Load the reference path on autoload, so go to in
vendor/composer/autoload_namespaces.php
and put in the array
'YourBundleNameSpace\\YourBundleNameBundle' => array($vendorDir . '/yourbundlenamespace/your-bundle-name-bundle');
4 Register bundle: go to in
app/AppKernel.php
and put in the array $bundles the new bundle:
```
public function registerBundles()
{
$bundles = array(
//...
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
//...
// this is our bundle :)
$bundles[] = new YourBundleNameSpace\YourBundleNameBundle\YourBundleNameBundle();
}
```
UPDATE
Point 3: this method is not performance because when update via composer is overwrite, instead, you should do:
-go to on app/autoload.php
and put following code after $loader definition
```
//add customs classes
$loader->add('YourBundleNameSpace\\YourBundleNameBundle','vendor//yourbundlenamespace/your-bundle-name-bundle');
```
My appKernel.php looks like this:
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
new Blogger\BlogBundle\BloggerBlogBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
My autoload.php looks like:
<?php
use Symfony\Component\ClassLoader\UniversalClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
'Symfony' => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
'Sensio' => __DIR__.'/../vendor/bundles',
'JMS' => __DIR__.'/../vendor/bundles',
'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib',
'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib',
'Doctrine' => __DIR__.'/../vendor/doctrine/lib',
'Monolog' => __DIR__.'/../vendor/monolog/src',
'Assetic' => __DIR__.'/../vendor/assetic/src',
'Metadata' => __DIR__.'/../vendor/metadata/src',
));
$loader->registerPrefixes(array(
'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib',
'Twig_' => __DIR__.'/../vendor/twig/lib',
));
// intl
if (!function_exists('intl_get_error_code')) {
require_once __DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
$loader->registerPrefixFallbacks(array(__DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs'));
}
$loader->registerNamespaceFallbacks(array(
__DIR__.'/../src',
));
$loader->register();
AnnotationRegistry::registerLoader(function($class) use ($loader) {
$loader->loadClass($class);
return class_exists($class, false);
});
AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
// Swiftmailer needs a special autoloader to allow
// the lazy loading of the init file (which is expensive)
require_once __DIR__.'/../vendor/swiftmailer/lib/classes/Swift.php';
Swift::registerAutoload(__DIR__.'/../vendor/swiftmailer/lib/swift_init.php');
When I do:
php app/console assets:install web
I get the following:
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
Installing assets for Acme\DemoBundle into web/bundles/acmedemo
Installing assets for Symfony\Bundle\WebProfilerBundle into web/bundles/webprofiler
Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodistribution
Why is my BloggerBlogBundle not getting copied over?
Note: As OP's answer is short and doesn't really go into too much detail, here's a more in-depth answer for future readers, so hopefully you don't have to do as much digging as I did! :)
It seems that we're following the exact same tutorial and have the exact same issue, and as the answer above isn't very descriptive and I had to do a little digging myself, here's exactly what's wrong.
Step 1
Your src/Blogger/BlogBundle needs to have, in the /resources folder, a public/css folder. So you need to place your CSS files as follows:
src/Blogger/BlogBundle/resources/public/css/<stylesheet>.css
Create the /public/css folder if it doesn't exist (it didn't exist for me).
Step 2
You need to run the assetic management tool to have a symlink created in /web automatically for you so these can be accessed.
php app/console assets:install web
You now will notice that if you open (using windows explorer / nautilus on linux) your dev directory and find the /web folder, that /web/bundles/bloggerblog/css/<stylesheet>.css has been created automatically for you!
You can now access your CSS files in your code using:
<link href="{{ asset('/bundles/bloggerblog/css/<stylesheet>.css') }}" type="text/css" rel="stylesheet" />
Note: '.css' is replaced with screen 'screen.css' for this tutorial
...and that should be it!
I have the the exact same problem with the original question, where assets are not copied over from Resources folder of bundles to web/bundles after running 'php app/console assets:install web' so what i did was running this command 'php app/console cache:clear --env=prod' and that fixed it. As you can see that you are dealing with prod assets or installing assets to prod environment in web directory, so clear cach for prod is reasonable. So do this:
1) $ php app/console cache:clear --env=prod
2) $ php app/console assets:install web
OR $ php app/console assets:install web --symlink
3) $ php app/console assetic:dump --env=prod (If you use built in Assetic, it will dump/combine css to one big one in /web/css as opposed to /web/bundles)
everything goes in place after that. you get all assets in your /web/bundles and assetic dump in /web/css and all of these are for prod env.
Just had this problem, ensure that the BlahBundle.php is located in the same directory as the Resources directory
I've had this issue today with Symfony3.3.13 and the problem was the public directory was actually capitalised Public, which seems to break the install script. Changing the name and it worked immediately.