sonata-project / sonatablockbundle Goto Github PK
View Code? Open in Web Editor NEWSymfony SonataBlockBundle
Home Page: https://docs.sonata-project.org/projects/SonataBlockBundle
License: MIT License
Symfony SonataBlockBundle
Home Page: https://docs.sonata-project.org/projects/SonataBlockBundle
License: MIT License
https://github.com/sonata-project/SonataBlockBundle/blob/master/Model/BlockInterface.php#L131
I think the use of __toString() in the BlockInterface is unclear. I could see it making some sense if it would be responsible for returning the HTML representation but as it standards right now it returns some sort of custom identifier format in the default implementation.
I have started a discussion on the use of __toString() and I think the use in the BlockBundle is probably not a good idea:
http://pooteeweet.org/blog/2231
sonata-project/SonataAdminBundle#606 is really a SonataBlockBundle as Stof and rande pointed out.
Hello,
I try to create a custom block with sonata admin specialy SonataBlockBundle but I have this error :
ContextErrorException: Warning: Missing argument 1 for xxxSearchBundle\Block\Service\ImportBlockService::__construct(), called in /var/www/myapp/app/cache/dev/appDevDebugProjectContainer.php on line 3943 and defined in /var/www/myapp/src/xxx/SearchBundle/Block/Service/ImportBlockService.php line 19
You can see the code here : https://gist.github.com/exotux/09950447ade746ddf782
Can you help me ?
Thanks.
I just wanted to update my Symfony2 Project and got the following error from composer:
- Updating sonata-project/block-bundle dev-master (92b2bfd => ed16453)
Checking out ed16453d75e4e7e2d41b022147805ee3e4628450
[RuntimeException]
Failed to clone http://github.com/sonata-project/SonataBlockBundle via git, https and http protocols, aborting.
- git://github.com/sonata-project/SonataBlockBundle
fatal: Not a git repository (or any parent up to mount parent )
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
- https://github.com/sonata-project/SonataBlockBundle
fatal: Not a git repository (or any parent up to mount parent )
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
- http://github.com/sonata-project/SonataBlockBundle
fatal: Not a git repository (or any parent up to mount parent )
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
hi,
Just a little feature. I'd like to extend BlockHelper but all the class variables are private.
Would be great to have them public
I'm using version 2.1.x-dev
I got this during update.
[InvalidArgumentException]
The file "block.xml" does not exist (in: /var/www/www.zuo.com/shared/vendor/sonata-project/block-bundle/Sonata/BlockBundle/DependencyInjection/DependencyInjection/../Resources/config).
Error is in the command line during clear symfony cache file.
I have latest Symfony 2.2.x dev version in my composer file and dev-master of SonataBlockBundle.
This happened after update Symfony by composer to latest dev version
There is an error in the getDefaultOptions() method in ServiceListType.
In the parent declaration of ChoiceType there is no parameter $options, so I receive an error.
I'm trying to create a new block. However everytime I do I always recieve an error stating that the block service doesn't exist if I attempt to add it directly to the twig template.
Has anybody else experienced this problem. I'm basically attempting to create a KnpMenu block...
FYI. I get the following error in the logs.
request.CRITICAL: RuntimeException: The block service application.sonata.block.service.menu
does not exists (uncaught exception) at /vagrant/vendor/bundles/Sonata/BlockBundle/Block/BlockServiceManager.php line 47 [] []
Despite having the following in my services configuration
<service id="application.sonata.block.service.menu" class="Application\Sonata\BlockBundle\Block\MenuBlockService">
<tag name="sonata.block" />
<argument>application.sonata.block.service.menu</argument>
<argument type="service" id="templating" />
</service>
And the following in my configuration yml file.
sonata_block:
blocks:
sonata.admin.block.admin_list:
contexts: [admin]
sonata.block.service.text:
sonata.block.service.action:
application.sonata.block.service.menu:
default_contexts: [cms]
Hello,
There is an inconsistency between admin-bundle ManagerInterface namespace (Sonata\CoreBundle\Entity) and block-bundle use declaration:
use Sonata\CoreBundle\**Model**\ManagerInterface;
(with dev-master version of both bundles).
Thanks
If block have cached, her not view in profiler.
It would be nice to display the status of the cache
As explained here (at 3.4 ):
http://sonata-project.org/bundles/block/master/doc/reference/your_first_block.html
Reason :
The method signature changed since 28/03 : public function
public function execute(BlockInterface $block, Response $response = null)
is now :
execute(BlockContextInterface $blockContext, Response $response = null);
(in vendor/sonata-project/block-bundle/Sonata/BlockBundle/Block/BlockServiceInterface.php)
Please update the documentation ;-)
I cannot install SonataBlockBundle on symfony 2.1. The Composer says:
Your requirements could not be resolved to an installable set of packages.
Can only install one of: knplabs/knp-menu-bundle v1.1.0, knplabs/knp-menu-bundle dev-master.
I would like to set cache expire parameter ttl.
First method by config.yml:
my_block_id:
cache: sonata.cache.memcached
settings: {ttl: 60}
Second method:
public function setDefaultSettings(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array('ttl' => 60));
}
Both methods donot work. Ttl is always set to default value 84600.
Hello,
When setting getJavascripts and getStylesheets in BlockService, SonataBlockBundle includes assets without using the AssetHelper.
In my case I have to set full paths to assets. This is a problem as paths in my dev environment differ from those in production.
When can you push a new stable version ?
There is a important PR to pass in order to be not stucked in production: #61
Thanks.
Hey,
I just updated my vendors for the latest SonataAdminBundle and therefore also the BlockBundle was checked out. Trying to build the cache I'm getting this weird error:
PHP Fatal error: Can't inherit abstract function Twig_ExtensionInterface::getName() (previously declared abstract in Symfony\Component\Templating\Helper\HelperInterface) in /usr/share/iserv/symfony/vendor/sonata-project/block-bundle/Sonata/BlockBundle/Twig/Extension/BlockExtension.php on line 17
I don't understand the message as it's implying that one abstract class extends a method from its parent abstract class.
Edit: After another look I found that both Twig_ExtensionInterface
and the inherited Symfony\Component\Templating\Helper\HelperInterface
require a getName()
method.
Cheers
Matthias
I think we have broken responsibility at Block Helper.
This class has too many dependencies - https://github.com/sonata-project/SonataBlockBundle/blob/master/Templating/Helper/BlockHelper.php#L69
One of the method (render) is so huge - https://github.com/sonata-project/SonataBlockBundle/blob/master/Templating/Helper/BlockHelper.php#L306
I propose take out some logic to separate service. In our app I create interface:
<?php
namespace Sonata\BlockBundle\Cache;
interface BlockCacheManagerInterface
{
public function setBlockToCache(BlockInterface $block);
public function getBlockFromCache($blockName, array $cacheKeys);
public function getCacheService(BlockInterface $block);
}
Please give your response about this, that I can to pack my code in PR
Following our talks regarding Issue #112 I am creating this, for the update of the installation guide that does not mention the new core-bundle requirement: http://sonata-project.org/bundles/admin/master/doc/reference/installation.html
Thanks a lot for your work!
Commit b832750, which is contained in tagged version 2.2.12, introduced a reference to use Sonata\CoreBundle\Model\PageableManagerInterface. The problem with this is that no tagged version of SonataCoreBundle contains this interface; it exists only in master, yet the reference to "sonata-project/core-bundle" in SonataBlockBundle's composer.json is "~2.2", so composer will attempt to pull in the latest tagged version of SonataCoreBundle (which at the time of this writing is 2.2.5, and does not contain PageableManagerInterface. Adding a line to the project's composer.json to pull in "sonata-project/core-bundle" at "dev-master" does not work, either, as even the latest tagged version of SonataPageBundle (at the time of this writing 2.3.6) does not implement Sonata\CoreBundle\Model\PageableManagerInterface::getPager() in it's Entity/BlockManager.php.
The work-around that I have found to work at this time in my project to prevent breakage is to change the "sonata-project/block-bundle" line in composer.json to read "~2.2.0,<2.2.12", and then composer update works just fine. I'm not sure which project to open this against, but since the change in my composer.json is to SonataBlockBundle, it feels like this is the right place to start.
Thanks.
Just noticed that the master
version does not show the Advanced usage
chapter.
http://sonata-project.org/bundles/block/master/doc/index.html
If you type in the url (http://sonata-project.org/bundles/block/master/doc/reference/advanced_usage.html) it does not display the latest version.
hi,
i just do a composer update on sf2.2.1 and got this error:
[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] The annotation "@thrown" in method Sonata\BlockBundle\Block\BlockContextManager::get() was never imported. Did you maybe forget to add a "use" statement for this annotation?
i don't use specific block in my admin, i check the doc, i got same...i don't understand
here the config:
sonata_block:
default_contexts: [cms]
blocks:
sonata.admin.block.admin_list:
contexts: [admin]
sonata.block.service.text:
sonata.block.service.action:
sonata.block.service.rss:
what is the $media argument on BlockHelper::includeJavascripts for?
https://github.com/sonata-project/SonataBlockBundle/blob/master/Templating/Helper/BlockHelper.php#L106
i guess it was added by accident but now can't be removed anymore as it would be a BC break. would be good to document those arguments to make things more understandable.
it prevents this bundle to be reusable in other project. i just need to be able to render dynamic blocks, but im not using any other sonata bundles. loading sonata admin is huge overhead
Hey there,
it seems that the saving hooks preDelete and postDelete in Sonata\BlockBundle\Block\BlockServiceInterface are not called when a block is deleted. Is it just me or is this a bug? I am using Symfony 2.1.7 and the sonata admin and page bundle to edit, remove, add blocks...
With the current implementation it is very hard to customize which template to use to render a block. This can be done per block and not globally.
For now, there is 2 values which are context dependents :
I would like to refactor the code as defined in the gist : https://gist.github.com/2375707
( ! ) Strict standards: Declaration of Sonata\SeoBundle\Block\Breadcrumb\HomepageBreadcrumbBlockService::getMenu() should be compatible with Sonata\BlockBundle\Block\Service\MenuBlockService::getMenu(array $settings) in /home/vagrant/vendor/sonata-project/seo-bundle/Sonata/SeoBundle/Block/Breadcrumb/HomepageBreadcrumbBlockService.php on line 21
Call Stack
# Time Memory Function Location
1 0.0054 254976 {main}( ) ../app_dev.php:0
2 0.0658 2174584 Symfony\Component\HttpKernel\Kernel->handle( ) ../app_dev.php:36
3 0.0658 2174768 Symfony\Component\HttpKernel\Kernel->boot( ) ../bootstrap.php.cache:2301
4 2.1152 9174832 Symfony\Component\HttpKernel\Kernel->initializeContainer( ) ../bootstrap.php.cache:2270
5 2.5925 15328032 Symfony\Component\DependencyInjection\ContainerBuilder->compile( ) ../bootstrap.php.cache:2491
6 2.5963 15365912 Symfony\Component\DependencyInjection\Compiler\Compiler->compile( ) ../ContainerBuilder.php:619
7 12.5954 29174768 JMS\AopBundle\DependencyInjection\Compiler\PointcutMatchingPass->process( ) ../Compiler.php:117
8 12.8363 41236136 JMS\AopBundle\DependencyInjection\Compiler\PointcutMatchingPass->processDefinition( ) ../PointcutMatchingPass.php:64
9 12.8363 41236184 class_exists ( ) ../PointcutMatchingPass.php:110
10 12.8363 41236648 Composer\Autoload\ClassLoader->loadClass( ) ../PointcutMatchingPass.php:0
11 12.8365 41242312 include( '/home/vagrant/vendor/sonata-project/seo-bundle/Sonata/SeoBundle/Block/Breadcrumb/HomepageBreadcrumbBlockService.php' ) ../ClassLoader.php:269
SeoBundle: 1.1.5
BlockBundle: 2.2.8
Could it be possible to tag the master branch, because on the master the methods signature are the same. Thanks
I know this is not something that will be easy to fix, but what is the point of the $media argument on the stylesheets call? would it not be the job of the block service to know what stylesheet is for which media? how would the template including the css know? and how would it handle different stylesheets for print and screen?
that said, we tend to define all css in a common place and combine it all with assetic, rather than include fragments on a par page + per block basis, as this is not caching friendly. still as the feature is there, rather have it meaningful.
I'm trying to use Varnish as a backend storage for the blocks.
Here is a configuration excerpt :
sonata_cache:
caches:
esi:
servers:
- varnishadm -T 127.0.0.1:2000 {{ COMMAND }} "{{ EXPRESSION }}"
sonata_block:
http_cache:
handler: sonata.cache.esi
Here is a kernel file excerpt :
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\CacheBundle\SonataCacheBundle(),
new Sonata\SeoBundle\SonataSeoBundle(),
new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
new Sonata\NotificationBundle\SonataNotificationBundle(),
new Application\Sonata\NotificationBundle\ApplicationSonataNotificationBundle(),
new Application\Sonata\PageBundle\ApplicationSonataPageBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
And here is the error I get :
InvalidArgumentException: The service definition "sonata.cache.esi" does not exist.
in /home/users/gparis/workspace/vod-cms/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php line 867
at ContainerBuilder->getDefinition('sonata.cache.esi') in /home/users/gparis/workspace/vod-cms/vendor/sonata-project/block-bundle/DependencyInjection/SonataBlockExtension.php line 144
at SonataBlockExtension->configureCache(object(ContainerBuilder), array('default_contexts' => array('sonata_page_bundle'), 'context_manager' => 'sonata.page.block.context_manager', 'http_cache' => array('handler' => 'sonata.cache.esi', 'listener' => true), 'blocks' => array('sonata.user.block.menu' => array('contexts' => array('sonata_page_bundle'), 'cache' => 'sonata.cache.noop', 'settings' => array()), 'sonata.user.block.account' => array('contexts' => array('sonata_page_bundle'), 'cache' => 'sonata.cache.noop', 'settings' => array()), 'sonata.admin.block.admin_list' => array('contexts' => array('admin'), 'cache' => 'sonata.cache.noop', 'settings' => array()), 'sonata.block.service.text' => array('contexts' => array('sonata_page_bundle'), 'cache' => 'sonata.cache.noop', 'settings' => array()), 'sonata.block.service.rss' => array('contexts' => array('sonata_page_bundle'), 'cache' => 'sonata.cache.noop', 'settings' => array())), 'profiler' => array('enabled' => '%kernel.debug%', 'template' => 'SonataBlockBundle:Profiler:block.html.twig', 'container_types' => array('sonata.block.service.container', 'sonata.page.block.container', 'cmf.block.container', 'cmf.block.slideshow')), 'templates' => array('block_base' => null, 'block_container' => null), 'container' => array('types' => array('sonata.block.service.container', 'sonata.page.block.container', 'cmf.block.container', 'cmf.block.slideshow'), 'templates' => array('SonataPageBundle:Block:block_container.html.twig' => 'SonataPageBundle default template', 'SonataSeoBundle:Block:block_social_container.html.twig' => 'SonataSeoBundle (to contain social buttons)')), 'menus' => array(), 'blocks_by_class' => array(), 'exception' => array('default' => array('filter' => 'debug_only', 'renderer' => 'throw'), 'filters' => array('debug_only' => 'sonata.block.exception.filter.debug_only', 'ignore_block_exception' => 'sonata.block.exception.filter.ignore_block_exception', 'keep_all' => 'sonata.block.exception.filter.keep_all', 'keep_none' => 'sonata.block.exception.filter.keep_none'), 'renderers' => array('inline' => 'sonata.block.exception.renderer.inline', 'inline_debug' => 'sonata.block.exception.renderer.inline_debug', 'throw' => 'sonata.block.exception.renderer.throw')))) in /home/users/gparis/workspace/vod-cms/vendor/sonata-project/block-bundle/DependencyInjection/SonataBlockExtension.php line 65
at SonataBlockExtension->load(array(array('default_contexts' => array('sonata_page_bundle'), 'context_manager' => 'sonata.page.block.context_manager', 'http_cache' => array('handler' => 'sonata.cache.esi'), 'blocks' => array('sonata.user.block.menu' => null, 'sonata.user.block.account' => null, 'sonata.admin.block.admin_list' => array('contexts' => array('admin')), 'sonata.block.service.text' => null, 'sonata.block.service.rss' => null))), object(ContainerBuilder)) in /home/users/gparis/workspace/vod-cms/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php line 50
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in /home/users/gparis/workspace/vod-cms/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php line 39
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in /home/users/gparis/workspace/vod-cms/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php line 117
at Compiler->compile(object(ContainerBuilder)) in /home/users/gparis/workspace/vod-cms/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php line 613
at ContainerBuilder->compile() in /home/users/gparis/workspace/vod-cms/app/bootstrap.php.cache line 2496
at Kernel->initializeContainer() in /home/users/gparis/workspace/vod-cms/app/bootstrap.php.cache line 2275
at Kernel->boot() in /home/users/gparis/workspace/vod-cms/app/bootstrap.php.cache line 2306
at Kernel->handle(object(Request)) in /home/users/gparis/workspace/vod-cms/web/app_dev.php line 28
If I remove the line that configures the handler, I can see the esi cache backend service in the container:debug
command output.
app/console container:debug|grep cache
cache_clearer container Symfony\Component\HttpKernel\CacheClearer\ChainCacheClearer
cache_warmer container Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate
sensio_framework_extra.cache.listener container Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener
sonata.admin.route.cache container Sonata\AdminBundle\Route\RoutesCache
sonata.admin.route.cache_warmup container Sonata\AdminBundle\Route\RoutesCacheWarmUp
sonata.block.cache.handler n/a alias for "sonata.block.cache.handler.default"
sonata.block.cache.handler.default container Sonata\BlockBundle\Cache\HttpCacheHandler
sonata.block.cache.handler.noop container Sonata\BlockBundle\Cache\NoopHttpCacheHandler
sonata.cache.esi container Sonata\CacheBundle\Adapter\VarnishCache
sonata.cache.invalidation.simple container Sonata\CacheBundle\Invalidation\SimpleCacheInvalidation
sonata.cache.manager container Sonata\Cache\CacheManager
sonata.cache.model_identifier container Sonata\Cache\Invalidation\ModelCollectionIdentifiers
sonata.cache.noop container Sonata\Cache\Adapter\Cache\NoopCache
sonata.cache.orm.event_subscriber container Sonata\CacheBundle\Invalidation\DoctrineORMListenerContainerAware
sonata.cache.orm.event_subscriber.default container Sonata\CacheBundle\Invalidation\DoctrineORMListener
sonata.cache.recorder container Sonata\Cache\Invalidation\Recorder
sonata.page.cache.js_async container Sonata\PageBundle\Cache\BlockJsCache
sonata.page.cache.js_sync container Sonata\PageBundle\Cache\BlockJsCache
Note that the esi cache service appears after the cache handler service, so it might be an order problem.
My context is within using the sonata_block_render within an if/conditional construct in twig. To check if the block is there or use a different block if it is not there. Is something like this is possible?
{% if {{ sonata_block_render({ 'name': '/cms/specific-logo' }) }} %}
{{ sonata_block_render({ 'name': '/cms/specific-logo' }) }}
{% else %}
{{ sonata_block_render({ 'name': '/cms/generic-logo' }) }}
{% endif %}
If there is a way to do this and my syntax is just wrong, please let me know. Thanks!
Hey,
I use the sonata pages bundle that uses blocks.
I got an issue while saving a block that is inside a container ( the RSS block from this bundle)
The RSS block (sonata.block.service.rss, RssBlockService.php) renders a form with a sonata_type_immutable_array for the url and the title of the rss feed.
while saving this form, a InvalidPropertyException is thrown in PropertyPath.php in line 441
Any idea about this?
Thank you
seb
Just made a composer.phar update and after the update of block bundle, get the following error:
Notice: Undefined index: default in vendor/sonata-project/block-bundle/Sonata/BlockBundle/DependencyInjection/SonataBlockExtension.php line 169
A Symfony 2.1 project.
When logging into the admin, I get the following error:
FatalErrorException: Error: Call to undefined method Sonata\AdminBundle\Block\AdminListBlockService::renderPrivateResponse() in /htdocs/app/cache/dev/classes.php line 3416
Changing the renderPrivateResponse() call to just renderResponse() works.
[Symfony\Component\Config\Definition\Exception\InvalidDefinitionException]
->addDefaultsIfNotSet() is not applicable to prototype nodes at path "sonata_block.blocks"
Just started seeing this error - I am getting the dependency through "symfony-cmf/block-bundle": "1.0.*"
I added "sonata-project/block-bundle": "2.2.7"
below that and no longer see that, so must be something in the dev branch.
Hello,
I would to remove the buildEditForm/buildCreateForm from the default interface and move them to a BlockAdminServiceInterface
interfance. This will also come to add a the BlockFormServiceInterface
to handle standard symfony form.
This will be part of a 2.3 series.
interface BlockAdminServiceInterface
{
/**
* @param FormMapper $form
* @param BlockInterface $block
*
* @return void
*/
public function buildEditForm(FormMapper $form, BlockInterface $block);
/**
* @param FormMapper $form
* @param BlockInterface $block
*
* @return void
*/
public function buildCreateForm(FormMapper $form, BlockInterface $block);
}
interface BlockFormServiceInterface
{
/**
* @param string $type
* @param FormBuilder $formBuilder
* @param BlockInterface $block
*
* @return mixed
*/
public function buildForm($type, FormBuilder $formBuilder, BlockInterface $block);
}
Hello
I would like to introduce a new feature in the block bundle, the ability to define a visibility range for a block.
Let's say you have an ecommerce website and some blocks might be only visible on monday between 7pm to 8pm. This feature will try to solve this.
The implementation is still not done yet, I just want some feedbacks about this feature.
Hi,
On a project i have a block which render a form.
So declared my controller as a service on call him in the execute method of my BlockService class.
public function execute(BlockContextInterface $blockContext, Response $response = null)
{
return $this->contactController->formAction();
}
The problem is that in the controller, i need to redirect. Like this:
public function formAction()
{
$contact = new Contact();
$request = $this->getRequest();
if ($request->getMethod() == 'POST')
{
$form->bind($request);
if ($form->isValid())
{
//Send the mail here.
$this->get('session')->getFlashBag()->add('success', 'Your message has been sent.');
$response = $this->redirect($this->generateUrl('core_page_view', array('slug' => 'contact')));
return $response->send();
}
}
return new Response($this->renderView('TestBundle:Contact:form.html.twig', array('form' => $form->createView())));
}
It works. But in log file when i send the redirection, i get this CRITICAL message:
[2014-09-15 14:31:31] app.CRITICAL: [cms::renderBlock] block.id=32 - error while rendering block - The Response content must be a string or object implementing __toString(), "boolean" given. [] []
[2014-09-15 14:31:31] request.CRITICAL: Uncaught PHP Exception UnexpectedValueException: "The Response content must be a string or object implementing __toString(), "boolean" given." at /home/jamal/Development/web/cs2it/coach-copro/app/bootstrap.php.cache line 1346 {"exception":"[object] (UnexpectedValueException: The Response content must be a string or object implementing __toString(), \"boolean\" given. at /var/www/test/app/bootstrap.php.cache:1346)"} []
Is there a solution to redirect properly in a block ?
right now i get the following errors when i open the profiler when loading cmf.liip.ch/en locally
with the following changes i get things to at least not explode
diff --git a/Block/TraceableBlockRenderer.php b/Block/TraceableBlockRenderer.php
index 980a9d9..63fc370 100644
--- a/Block/TraceableBlockRenderer.php
+++ b/Block/TraceableBlockRenderer.php
@@ -61,6 +61,9 @@ class TraceableBlockRenderer extends BlockRenderer
'type' => $block->getType(),
'time_start' => microtime(true),
'memory_start' => memory_get_usage(true),
+ 'time_end' => 0,
+ 'memory_end' => 0,
+ 'memory_peak' => 0,
);
}
@@ -71,9 +74,7 @@ class TraceableBlockRenderer extends BlockRenderer
*/
public function endTracing(BlockInterface $block)
{
- $trace =& $this->traces[$block->getId()];
-
- $trace = array_merge($trace, array(
+ $this->traces[$block->getId()] = array_merge($this->traces[$block->getId()], array(
'time_end' => microtime(true),
'memory_end' => memory_get_usage(true),
'memory_peak' => memory_get_peak_usage(true),
the odd thing is that i only have 4 blocks on the page. one is a container block which wraps the 3 other blocks inside.
Since Symfony version 2.1 the class Symfony\Component\Form\Exception\FormException is an interface.
This class is still used in the SonataBlockBundle in the file
SonataBlockBundle\Form\Type\ServiceListType.php.
I think this should be replaced with another Exception.
Also see https://github.com/symfony/symfony/blob/master/UPGRADE-2.2.md for more information about the removal of the FormException class under section Form, the second point.
I will post a fix soon.
For SonataDoctrinePhpcrAdmin, we usually define a tree block. We define a default setting for the id
value. See for example https://github.com/symfony-cmf/cmf-sandbox/blob/master/app/config/config.yml#L139
This parameter is defined in the SonataBlockBundle configuration class. However, i can't find it being processed in the DI extension and it does not arrive at our TreeBlockService
After adding BlockBundle in the project i have an error:
ServiceNotFoundException: The service "twig" has a dependency on a non-existent service "sonata.cache.manager".
Looks like in the documentation missed dependency to the SonataCacheBundle?
Hi all,
As a result of the discution on this issue : symfony-cmf/block-bundle#192
I would like to know if it is possible to add a parameter in the config of the block bundle to deactivate the BlockDataCollector.
By default it will be activate and if we set the parameter to false, the dataCollector would be inactive.
Would it be possible?
Is it normal to break backward compatibility between to patchs? 2.2.3...2.2.4
I use the BlockBundle as a requirement for the SonataAdminBundle (a wonderful piece of work!). I don't use it elsewhere in my app.
Today I discovered it was setting cache headers for Response objects in my front end app, effectively disabling caching entirely, nullifying the CDN and taking the app down.
I eventually tracked down the problem to HttpCacheHandler which was listening to the kernel.response event and altering the cache headers, specifically setting s-maxage=0
I think this is related to 1e6adfa
I was able to fix my problem by turning off the listener in the config.
sonata_block:
http_cache:
listener: false
Hi,
I'm currently upgrading a sonata 2.1 project to sonata 2.2 and get the following error if I visit the page as an authenticated user:
Method "id" for object "Sonata\BlockBundle\Block\BlockContext" does not exist in SonataPageBundle:Block:block_base.html.twig at line 23
meaning the unmodified block_base:
<div id="cms-block-{{ block.id }}" class="cms-block cms-block-element">
{% block block %}EMPTY CONTENT{% endblock %}
</div>
As for dependencies I used the ones from sandbox repository:
"sonata-project/easy-extends-bundle": "~2.1",
"sonata-project/seo-bundle": "~1",
"sonata-project/doctrine-extensions": "~1",
"sonata-project/intl-bundle": "~2.1",
"sonata-project/admin-bundle": "~2.2",
"sonata-project/doctrine-orm-admin-bundle": "~2.2",
"sonata-project/notification-bundle": "~2.2",
"sonata-project/block-bundle": "~2.2",
"sonata-project/media-bundle": "~2.2",
"sonata-project/user-bundle": "~2.2",
"sonata-project/cache-bundle": "~2.1",
"sonata-project/page-bundle": "~2.3",
"sonata-project/formatter-bundle": "~2.3",
"sonata-project/news-bundle": "~2.3",
"sonata-project/exporter": "~1.3",
"sonata-project/timeline-bundle": "~2.2@dev",
"sonata-project/classification-bundle": "~2.2",
Would be thankful for a hint.
Hi,
sonata-project/cache-bundle: master-dev
instead of sonata-project/cache-bundle: dev-master
Hi,
I'm actually creating block for adding Datagrid
Those grids need a route as described here https://github.com/Abhoryo/APYDataGridBundle/blob/master/Resources/doc/grid_configuration/set_grid_route.md
The problem is that when I add a route on the execute method, the route appears in the router:debug but doesn't work in the browser. I get a 404.
I guess it's because the execute method isn't a real controller.
Thanks
hi,
I have an error on my production server.
FatalErrorException: Compile Error: Declaration of Sonata\BlockBundle\Block\TraceableBlockRenderer::render() must be compatible with that of Sonata\BlockBundle\Block\BlockRendererInterface::render() in /var/www/xxxx/vendor/sonata-project/block-bundle/Sonata/BlockBundle/Block/TraceableBlockRenderer.php line 25
I don't understand because, interface is good....
My configuration :
Symfony 2.2.0
SonataBlock 2.2.x-dev
An idea ?
Thank you
First, I did notice that the default Block
can have children and parents. Correct me if I'm wrong, but isn't that for persisting blocks to the database via the CMF bundle?
What I'm suggesting is a way for users to register a container block as a service, for example SidebarService
and for that container to have associated children which are also services but registered with a different tag. The code would be something like this:
class PluginBlockService extends BaseBlockService
{
public function __construct($name, EngineInterface $templating,$tagged)
{
}
}
class SidebarWhatsNewService extends BaseBlockService
{
}
services:
acme.sidebar.container:
class: Acme\Bundle\Block\Service\SidebarBlockService
arguments:
- acme.sidebar.container
- @templating
- my.custom.sidebar.tag
tags:
- { name: sonata.block }
acme.sidebar.widget:
class: Acme\Bundle\Block\Service\SidebarWhatsNewService
tags:
- { my.custom.sidebar.tag }
The container block should be added to the existing blocks (hence the name Plugin and not Container). This way users only need register the service(s) and optionally extend the base classes for finer control.
I have implemented this in my own project, and it works.
I had to create my own WidgetLoader
tagged with sonata.block.loader
. I then had to create a CompilerPass
to scan for the custom tag and add to both sonata.block.manager
and the c'tor of my WidgetLoader
, which is then able to create and return the blocks. I can now render the sidebar without having to hardcode the content, And add/remove content blocks with ease.
I feel this should be in the core. Also, it can be implemented without breaking anything.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.