SonataPageBundle icon indicating copy to clipboard operation
SonataPageBundle copied to clipboard

Release 4.0

Open eerison opened this issue 3 years ago • 273 comments

I'm using this branch to test the upgrade from 3.x branch to 4.x

Those issues need to be solved before release 4.0 version

CSS / Javascript:

Other:

  • [ ] https://github.com/symfony/recipes-contrib/pull/1440 update recipe
  • [ ] Menu block is returning an internal server error: https://github.com/sonata-project/SonataPageBundle/issues/1495#issuecomment-1269493681
  • [ ] https://github.com/sonata-project/SonataSeoBundle/pull/696

Completed:

  • [x] #1627
  • [x] #1624
  • [x] https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/1695 , and requires ^4.8, Batch delete for shared blocks does not work: https://github.com/sonata-project/SonataPageBundle/issues/1495#issuecomment-1252027436
  • [x] #1623 Composer page is not working when there are blocks that doesn't exist
  • [x] #1609
  • [x] #1474
  • [x] #1615 List label for snapshot list was not found: https://github.com/sonata-project/SonataPageBundle/issues/1495#issuecomment-1252032137
  • [x] https://github.com/sonata-project/SonataAdminBundle/pull/7922 #1615 Composer page is not showing errors: https://github.com/sonata-project/SonataPageBundle/issues/1495#issuecomment-1235626107
  • [x] #1618 I can't select a shared block into my page: https://github.com/sonata-project/SonataPageBundle/issues/1495#issuecomment-1252021888
  • [x] Remove deprecate blocks from base_layout.html.twig
  • [x] #1586
  • [x] #1583 #1573
  • [x] Test if multi site works with the current code!
  • [x] #1596 Deprecate css/js configuration in 3.x and remove in 4.x
  • [x] The block link is not going to edit form, look this comment: https://github.com/sonata-project/SonataPageBundle/issues/1495#issuecomment-1226906394
  • [x] Block show is empty, Look this comment: https://github.com/sonata-project/SonataPageBundle/issues/1495#issuecomment-1226906394
  • [x] #1581 Add an upgrade note to remove sonata_block.context_manager: sonata.page.block.context_manager and sonata_page.slugify_service: sonata.page.slugify.cocur
  • [x] #1497
  • [x] #1579 Composer page is not adding block types
  • [x] Composer page is not working: https://github.com/sonata-project/SonataPageBundle/issues/1495#issuecomment-1211637698
  • [x] #1496 https://github.com/sonata-project/SonataPageBundle/pull/1532
  • [x] #1605 Check the navigation links, in snapshots, site and blocks admin
  • [x] Make sure that blocks removed on 4.x was deprecated in 3.x branch, to avoid errors like this An exception has been thrown during the rendering of a template ("The block service sonata.seo.block.email.share_button does not exist").
  • [x] #1498
  • [x] #1502 http://localhost:8001/admin/app/sonatapagesite/list is returning this internal server error: An exception has been thrown during the rendering of a template ("Cannot access property "create_snapshots" in class "App\Entity\SonataPageSite".").
  • [x] #1505 Create page is missing some translations: form.group_form_page_group_main_label, form.group_form_page_group_seo_label, form.group_form_page_group_advanced_label look here: https://github.com/sonata-project/SonataPageBundle/issues/1495#issuecomment-1195645922
  • [x] http://localhost:8001/admin/app/sonatapagepage/tree is returning Action "tree" could not be found in access mapping. Please make sure your action is defined into your admin class accessMapping property.
  • [x] #1524 at http://localhost:8001/admin/dashboard is returning An exception has been thrown during the rendering of a template ("The options "manager", "page_id" do not exist. Defined options are: "attr", "extra_cache_keys", "groups", "template", "ttl", "use_cache".").
  • [x] when I'm running composer update -W, I'm facing this issue Compile Error: Type of App\Entity\SonataPageBlock::$page must be ?Sonata\Pa !! geBundle\Model\PageInterface (as in class Sonata\PageBundle\Model\Block) at In SonataPageBlock.php line 16:
  • [x] When I access the composer page (http://localhost:8001/admin/app/sonatapagepage/642/compose), I got this error Variable "admin_pool" does not exist. https://github.com/sonata-project/SonataPageBundle/pull/1533
  • [x] #1539 Snapshot edit page is missing group translation: https://github.com/sonata-project/SonataPageBundle/issues/1495#issuecomment-1210275144
  • [x] #1535
  • [x] Problem when going to create a new publication from /admin/app/sonatapagesnapshot/create: https://github.com/sonata-project/SonataPageBundle/issues/1495#issuecomment-1210757295
  • [x] #1548 Create snapshot command is not working

eerison avatar Jul 26 '22 10:07 eerison

Updated Sonata admin 4

  • Issue setPosition #1496
Sonata\BlockBundle\Model\BaseBlock::setPosition(): Argument #1 ($position) must be of type int, null given, called in /app/vendor/sonata-project/page-bundle/src/Entity/Transformer.php on line 157

eerison avatar Jul 26 '22 10:07 eerison

well the 4.x branch is unusable, if you just navigate into the admin you will get some internal server error!

eerison avatar Jul 26 '22 15:07 eerison

do you think make sense I create more bug issues @VincentLanglet?

eerison avatar Jul 26 '22 15:07 eerison

Havind all the issues in the same issue might be enough

VincentLanglet avatar Jul 26 '22 15:07 VincentLanglet

For

http://localhost:8001/admin/app/sonatapagepage/tree

it's the same issue than https://github.com/sonata-project/SonataPageBundle/issues/1498

I proposed a solution.

VincentLanglet avatar Jul 26 '22 15:07 VincentLanglet

For

http://localhost:8001/admin/app/sonatapagepage/tree

it's the same issue than #1498

I proposed a solution.

NIce ❤️

eerison avatar Jul 26 '22 15:07 eerison

For

form.group_form_page_group_main_label, form.group_form_page_group_seo_label, form.group_form_page_group_advanced_label

I assume the translations exists either https://github.com/sonata-project/SonataPageBundle/blob/3.x/src/Resources/translations/SonataPageBundle.en.xliff#L133-L144 or https://github.com/sonata-project/SonataPageBundle/blob/3.x/src/Resources/translations/SonataPageBundle.en.xliff#L225-L236

But SonataAdmin changed the way he generated the translation keys. In 3.x foo.bar group were using the key foo_bar. In 4.x foo.bar group is using the key form.group_foo_bar.

So the form_page.group_seo_label translations should be updated. And we might simplify

form.group_form_page_group_main_label, form.group_form_page_group_seo_label, form.group_form_page_group_advanced_label

to

form.group_main_label, form.group_seo_label, form.group_advanced_label

By changing https://github.com/sonata-project/SonataPageBundle/blob/f2ca4ea390f0a9da0290fc85a847562a8a83dc7d/src/Admin/PageAdmin.php#L281-L283 to

             ->with('main_label', ['class' => 'col-md-6'])->end()
             ->with('seo_label', ['class' => 'col-md-6'])->end()
             ->with('advanced_label', ['class' => 'col-md-6'])->end();

or even

             ->with('main', ['class' => 'col-md-6'])->end()
             ->with('seo', ['class' => 'col-md-6'])->end()
             ->with('advanced', ['class' => 'col-md-6'])->end();

VincentLanglet avatar Jul 26 '22 15:07 VincentLanglet

For create_snapshot, it's https://github.com/sonata-project/SonataPageBundle/pull/1502 IMHO

VincentLanglet avatar Jul 26 '22 20:07 VincentLanglet

I added a new issue in dashboard

eerison avatar Jul 27 '22 06:07 eerison

Hey, I will work on missing translations

Amin-Hosseini avatar Jul 27 '22 10:07 Amin-Hosseini

@VincentLanglet have you tried to add this in the pipelines: https://symfony.com/doc/current/translation/debug.html to get the missing translations?

eerison avatar Jul 27 '22 14:07 eerison

@VincentLanglet have you tried to add this in the pipelines: https://symfony.com/doc/current/translation/debug.html to get the missing translations?

It would miss all the translation key generated dynamically if I understand correctly

VincentLanglet avatar Jul 27 '22 14:07 VincentLanglet

@VincentLanglet have you tried to add this in the pipelines: https://symfony.com/doc/current/translation/debug.html to get the missing translations?

It would miss all the translation key generated dynamically if I understand correctly

true :(

eerison avatar Jul 27 '22 14:07 eerison

  • at http://localhost:8001/admin/dashboard is returning An exception has been thrown during the rendering of a template ("The options "manager", "page_id" do not exist. Defined options are: "attr", "extra_cache_keys", "groups", "template", "ttl", "use_cache".").

For this error, seems like the BlockManager is done in 4.x is not working https://github.com/sonata-project/SonataPageBundle/blob/4.x/src/Block/BlockContextManager.php#L19 because the extra settings are not configured https://github.com/sonata-project/SonataBlockBundle/blob/375b168da31545bf3c386fd25a4b483411ac97c5/src/Block/BlockContextManager.php#L163

Is there a way to avoid removing the final keyword from the BlockBundle BlockManager ? cc @jordisala1991

VincentLanglet avatar Aug 01 '22 06:08 VincentLanglet

Saw the same error and tried to fix, but didn't found a solution without touching BlockBundle. I only tried for half an hour, so I might be wrong.

jordisala1991 avatar Aug 01 '22 06:08 jordisala1991

Saw the same error and tried to fix, but didn't found a solution without touching BlockBundle.

Seems ok to me to touch the BlockBundle, but I would have prefer to avoid removing the final keyword.

FormType has things like a getParent() method, I dunno if same could be done here. We could also provide an abstract class with everything implemented except the configureSettings method ; but seems like some settings need to be configured for every BlockManager, like template. So there is maybe something like configureDefaultSettings and configureExtraSettings... Didn't find a great pattern so far.

VincentLanglet avatar Aug 01 '22 06:08 VincentLanglet

Saw the same error and tried to fix, but didn't found a solution without touching BlockBundle. I only tried for half an hour, so I might be wrong.

I was checking with @Amin-Hosseini this issue related with BlockManager, and I guess it's possible make this work without remove the final class, Because if I got correct we are more or less decorating this BlockContextManager.php#L16

@Amin-Hosseini please share where what have you find ATM!

eerison avatar Aug 04 '22 06:08 eerison

I've checked #1483 changes and as we don't have OptionsResolver in src/Block/BlockContextManager.php anymore, error happens on $optionsResolver->resolve($settings); -> BlockBundle : BlockContextManager.php#L289

I tried to update get function on BlockContextManager to add (merge) $settings to $block but I guess we can fix this issue with add $optionsResolver->setDefaults($settings); to BlockBundle : BlockContextManager.php#L285

I can create a PR, if you think it's the good solution :-)

cc @jordisala1991

Amin-Hosseini avatar Aug 04 '22 13:08 Amin-Hosseini

I've checked #1483 changes and as we don't have OptionsResolver in src/Block/BlockContextManager.php anymore, error happens on $optionsResolver->resolve($settings); -> BlockBundle : BlockContextManager.php#L289

I tried to update get function on BlockContextManager to add (merge) $settings to $block but I guess we can fix this issue with add $optionsResolver->setDefaults($settings); to BlockBundle : BlockContextManager.php#L285

I can create a PR, if you think it's the good solution :-)

cc @jordisala1991

  • But does resolve still exist?
  • is it working as before? have you tested it and does it work?
  • ins't it possible to override this in the page bundle?

eerison avatar Aug 04 '22 13:08 eerison

I tried to update get function on BlockContextManager to add (merge) $settings to $block but I guess we can fix this issue with add $optionsResolver->setDefaults($settings); to BlockBundle : BlockContextManager.php#L285

I can create a PR, if you think it's the good solution :-)

I might misunderstand the solution but the issue I see is that we cannot validate the values/type of the extra settings ; it would be so nice to be able to configure extra settings in the PageBundle BlockContextManager. That's why I had in mind to provide an abstract class with extensions point.

VincentLanglet avatar Aug 04 '22 14:08 VincentLanglet

I tried to update get function on BlockContextManager to add (merge) $settings to $block but I guess we can fix this issue with add $optionsResolver->setDefaults($settings); to BlockBundle : BlockContextManager.php#L285 I can create a PR, if you think it's the good solution :-)

I might misunderstand the solution but the issue I see is that we cannot validate the values/type of the extra settings ; it would be so nice to be able to configure extra settings in the PageBundle BlockContextManager. That's why I had in mind to provide an abstract class with extensions point.

Well should be good we think in some solution using interfaces, usually those abstract class going to increase 😞

eerison avatar Aug 04 '22 14:08 eerison

when I'm running composer update -W, I'm facing this issue Compile Error: Type of App\Entity\SonataPageBlock::$page must be ?Sonata\Pa !! geBundle\Model\PageInterface (as in class Sonata\PageBundle\Model\Block) at In SonataPageBlock.php line 16:

It's an issue with your code IMHO @eerison

VincentLanglet avatar Aug 06 '22 08:08 VincentLanglet

when I'm running composer update -W, I'm facing this issue Compile Error: Type of App\Entity\SonataPageBlock::$page must be ?Sonata\Pa !! geBundle\Model\PageInterface (as in class Sonata\PageBundle\Model\Block) at In SonataPageBlock.php line 16:

It's an issue with your code IMHO @eerison

Really? I don't remember to change something inf Block::page

eerison avatar Aug 06 '22 08:08 eerison

Really? I don't remember to change something inf Block::page

Since we're adding typehint, you'll need to add some too. Composer is asking you to change $page to ?PageInterface $page in your entity

VincentLanglet avatar Aug 06 '22 08:08 VincentLanglet

when I'm running composer update -W, I'm facing this issue Compile Error: Type of App\Entity\SonataPageBlock::$page must be ?Sonata\Pa !! geBundle\Model\PageInterface (as in class Sonata\PageBundle\Model\Block) at In SonataPageBlock.php line 16:

It's an issue with your code IMHO @eerison

Ohhh do you mean the code from my project?

eerison avatar Aug 06 '22 08:08 eerison

Really? I don't remember to change something inf Block::page

Since we're adding typehint, you'll need to add some too. Composer is asking you to change $page to ?PageInterface $page in your entity

But do you mean the code from sonata page bundle or from my project?

Note: I don't have any custom class extending from sonata bundles

eerison avatar Aug 06 '22 08:08 eerison

Really? I don't remember to change something inf Block::page

Since we're adding typehint, you'll need to add some too. Composer is asking you to change $page to ?PageInterface $page in your entity

Ohh ok I guess I got it, I'll check that ;)

eerison avatar Aug 06 '22 08:08 eerison

It is strange that you have declared page property on your entity, Can you show that piece of code?

jordisala1991 avatar Aug 06 '22 08:08 jordisala1991

It is strange that you have declared page property on your entity, Can you show that piece of code?

I'm not in the computer atm, but my entities were generated in 3.x code, and I'm switching between 3.x and 4.x branch

eerison avatar Aug 06 '22 08:08 eerison

Can you also try https://github.com/sonata-project/SonataPageBundle/pull/1524 @eerison ? Or maybe explaining why we need a custom BlockContextManager.

I found no occurence of the page_id or manager keys.

VincentLanglet avatar Aug 06 '22 08:08 VincentLanglet