-
-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check why setPosition is set as null #1496
Comments
@eerison i might look into it, do you have a testcase for this to repoduce? |
Hey @Hanmac I just updated from 3.x to 4.x using sonata 4, and it crash my page, if you test it in some project you can see this issue! |
hm curious, you should probably check the content json data from your snapshots |
Hey @Hanmac I guess you are right, it's related with snapshot content, the position of container is {
"id":642,
"name":"Homepage",
"javascript":null,
"stylesheet":null,
"raw_headers":null,
"title":null,
"meta_description":null,
"meta_keyword":null,
"template_code":"default",
"request_method":"GET|POST|HEAD|DELETE|PUT",
"created_at":"1656521887",
"updated_at":"1656522565",
"slug":"",
"parent_id":null,
"target_id":null,
"blocks":[
{
"id":11,
"name":"container 1",
"enabled":true,
"position":null,
"settings":{
"code":null,
"layout":"{{ CONTENT }}",
"class":null,
"template":"@SonataPage\/Block\/block_container.html.twig"
},
"type":"sonata.block.service.container",
"created_at":"1656522317",
"updated_at":"1656522349",
"blocks":[
{
"id":9,
"name":"Test A",
"enabled":true,
"position":1,
"settings":{
"mode":"form.choice_public",
"title":"Title B",
"translation_domain":null,
"icon":"fa fa-globe",
"class":null,
"template":"@SonataPage\/Block\/block_pagelist.html.twig"
},
"type":"sonata.page.block.pagelist",
"created_at":"1656521962",
"updated_at":"1656522564",
"blocks":[
]
},
{
"id":10,
"name":"test s",
"enabled":true,
"position":2,
"settings":{
"content":"Insert your custom content here",
"template":"@SonataBlock\/Block\/block_core_text.html.twig"
},
"type":"sonata.block.service.text",
"created_at":"1656522079",
"updated_at":"1656522388",
"blocks":[
]
}
]
}
]
} in this case position id should be |
i don't know about BlockBundle to understand what the container is doing there and if the null position is valid there if it does, then it needs to be fixed in BlockBundle |
the container block is like the main container for example:
I don't know if it was clear, but it's more or less the |
@jordisala1991 BlockBundle requires position as integer But how do you handle this for |
I guess the problem not related with position only! I have others blocks that there isn't {
"id":652,
"name":"contact",
"javascript":null,
"stylesheet":null,
"raw_headers":null,
"title":null,
"meta_description":null,
"meta_keyword":null,
"template_code":"default",
"request_method":"GET|POST|HEAD|DELETE|PUT",
"created_at":"1656522709",
"updated_at":"1657119067",
"slug":"contact",
"parent_id":642,
"target_id":null,
"blocks":[
{
"id":15,
"name":"Top content",
"enabled":true,
"position":1,
"settings":{
"code":"content_top"
},
"type":"sonata.page.block.container",
"created_at":"1656571318",
"updated_at":"1656571318",
"blocks":[
{
"id":21,
"name":null,
"enabled":true,
"position":1,
"settings":{
"template":"@SonataSeo\/Block\/block_email_share_button.html.twig",
"subject":"subject test",
"body":"body test"
},
"type":"sonata.seo.block.email.share_button",
"created_at":"1656571654",
"updated_at":"1656571654",
"blocks":[
]
},
{
"id":22,
"name":null,
"enabled":true,
"position":2,
"settings":{
"mode":"form.choice_public",
"title":"ABBB",
"translation_domain":null,
"icon":"fa fa-globe",
"class":null,
"template":"@SonataPage\/Block\/block_pagelist.html.twig"
},
"type":"sonata.page.block.pagelist",
"created_at":"1656571709",
"updated_at":"1656571709",
"blocks":[
]
}
]
},
{
"id":16,
"name":"Main content",
"enabled":true,
"position":1,
"settings":{
"code":"content"
},
"type":"sonata.page.block.container",
"created_at":"1656571318",
"updated_at":"1656571318",
"blocks":[
{
"id":25,
"name":null,
"enabled":true,
"position":0,
"settings":{
"url":"https:\/\/facebook.com",
"title":"RSS feed",
"translation_domain":null,
"icon":"fa fa-rss-square",
"class":null,
"template":"@SonataBlock\/Block\/block_core_rss.html.twig"
},
"type":"sonata.block.service.rss",
"created_at":"1656574713",
"updated_at":"1657119037",
"blocks":[
]
},
{
"id":27,
"name":null,
"enabled":true,
"position":1,
"settings":{
"template":"@SonataSeo\/Block\/block_email_share_button.html.twig",
"subject":"test 12455",
"body":"test 4333"
},
"type":"sonata.seo.block.email.share_button",
"created_at":"1657118800",
"updated_at":"1657119037",
"blocks":[
]
},
{
"id":19,
"name":null,
"enabled":true,
"position":2,
"settings":{
"content":"SIMPLE TEXT :D",
"template":"@SonataBlock\/Block\/block_core_text.html.twig"
},
"type":"sonata.block.service.text",
"created_at":"1656571374",
"updated_at":"1657119037",
"blocks":[
]
},
{
"id":23,
"name":"aaa",
"enabled":true,
"position":3,
"settings":{
"title":"Breadcrumb (Homepage)",
"cache_policy":"public",
"template":"@SonataBlock\/Block\/block_core_menu.html.twig",
"menu_name":null,
"safe_labels":false,
"current_class":"active",
"first_class":null,
"last_class":null,
"current_uri":null,
"menu_class":"list-group",
"children_class":"list-group-item",
"menu_template":"@SonataSeo\/Block\/breadcrumb.html.twig",
"include_homepage_link":true,
"context":false
},
"type":"sonata.seo.block.breadcrumb.homepage",
"created_at":"1656571781",
"updated_at":"1657119037",
"blocks":[
]
},
{
"id":24,
"name":null,
"enabled":true,
"position":4,
"settings":{
"url":"https:\/\/google.com",
"title":"google link",
"translation_domain":null,
"icon":"fa fa-rss-square",
"class":null,
"template":"@SonataBlock\/Block\/block_core_rss.html.twig"
},
"type":"sonata.block.service.rss",
"created_at":"1656574614",
"updated_at":"1657119037",
"blocks":[
]
},
{
"id":26,
"name":"Instagram",
"enabled":true,
"position":5,
"settings":{
"url":"https:\/\/instagram.com",
"title":"INSTA PROD 45678",
"translation_domain":null,
"icon":"fa fa-rss-square",
"class":null,
"template":"@SonataBlock\/Block\/block_core_rss.html.twig"
},
"type":"sonata.block.service.rss",
"created_at":"1656574756",
"updated_at":"1657119037",
"blocks":[
]
}
]
},
{
"id":17,
"name":"Bottom content",
"enabled":true,
"position":1,
"settings":{
"code":"content_bottom"
},
"type":"sonata.page.block.container",
"created_at":"1656571318",
"updated_at":"1656571318",
"blocks":[
]
},
{
"id":18,
"name":"Footer",
"enabled":true,
"position":1,
"settings":{
"code":"footer"
},
"type":"sonata.page.block.container",
"created_at":"1656571318",
"updated_at":"1656571318",
"blocks":[
]
},
{
"id":14,
"name":"Header",
"enabled":true,
"position":1,
"settings":{
"code":"header"
},
"type":"sonata.page.block.container",
"created_at":"1656571318",
"updated_at":"1656571318",
"blocks":[
{
"id":20,
"name":"Menu 1",
"enabled":true,
"position":1,
"settings":{
"title":"sonata.block.menu",
"cache_policy":"public",
"template":"@SonataBlock\/Block\/block_core_menu.html.twig",
"menu_name":"sonata_admin_sidebar",
"safe_labels":false,
"current_class":"active",
"first_class":null,
"last_class":null,
"current_uri":null,
"menu_class":"list-group",
"children_class":"list-group-item",
"menu_template":null
},
"type":"sonata.block.service.menu",
"created_at":"1656571563",
"updated_at":"1656571563",
"blocks":[
]
}
]
}
]
} and I got the same issue
|
Looks like the Transformer.php could be changed to not assign null properties? |
i think thats an hotfix for now i checked BlockBundle code, the property says it can be null, the getter can return null values, but the setter can't set null values for some reason? should that be fixed in BlockBundle too? |
the container block is used in sonata page only? |
The getter can return I don't know if it makes sens to have a block without a name, a type or a position... Where come from your data @eerison ?
The issue is that changing the param typehint will be a BC break... |
when we create snapshot, it generates this content with the json
what we can do is |
This one should fix this problem: #1532 |
I got this on branch
4.x
Stack trace
But all my pages there are position value
The text was updated successfully, but these errors were encountered: