-
-
Notifications
You must be signed in to change notification settings - Fork 638
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
Sonata Page Bundle 4 #1440
Sonata Page Bundle 4 #1440
Conversation
eerison
commented
Oct 4, 2022
•
edited
Loading
edited
Q | A |
---|---|
License | MIT |
Packagist | https://packagist.org/packages/sonata-project/page-bundle |
Thanks for the PR 😍 How to test these changes in your application
Diff between recipe versionsIn order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes. sonata-project/page-bundle3.9 vs 4.0diff --git a/sonata-project/page-bundle/3.9/config/packages/sonata_page.yaml b/sonata-project/page-bundle/4.0/config/packages/sonata_page.yaml
index 6268a933..a8991ddc 100644
--- a/sonata-project/page-bundle/3.9/config/packages/sonata_page.yaml
+++ b/sonata-project/page-bundle/4.0/config/packages/sonata_page.yaml
@@ -1,16 +1,15 @@
sonata_block:
- context_manager: sonata.page.block.context_manager
default_contexts: [sonata_page_bundle]
sonata_admin:
assets:
extra_javascripts:
- - bundles/sonatapage/sonata-page.back.min.js
+ - bundles/sonatapage/app.js
extra_stylesheets:
- - bundles/sonatapage/sonata-page.back.min.css
+ - bundles/sonatapage/app.css
+# https://docs.sonata-project.org/projects/SonataPageBundle/en/4.x/reference/advanced_configuration/
sonata_page:
- slugify_service: sonata.page.slugify.cocur
multisite: host
use_streamed_response: false
@@ -33,6 +32,7 @@ sonata_page:
ignore_uri_patterns:
- ^/admin\/ # ignore admin route, ie route containing 'admin'
+ #https://docs.sonata-project.org/projects/SonataPageBundle/en/4.x/reference/page_composer/
default_template: default
templates:
default:
@@ -74,9 +74,3 @@ sonata_page:
catch_exceptions:
not_found: [404] # render 404 page with "not_found" key (name generated: _page_internal_error_{key})
fatal: [500] # so you can use the same page for different http errors or specify specific page for each error
-
- class:
- page: 'App\Entity\SonataPagePage'
- snapshot: 'App\Entity\SonataPageSnapshot'
- block: 'App\Entity\SonataPageBlock'
- site: 'App\Entity\SonataPageSite'
diff --git a/sonata-project/page-bundle/3.9/config/routes/sonata_page.yaml b/sonata-project/page-bundle/4.0/config/routes/sonata_page.yaml
index 764a52b0..f824032f 100644
--- a/sonata-project/page-bundle/3.9/config/routes/sonata_page.yaml
+++ b/sonata-project/page-bundle/4.0/config/routes/sonata_page.yaml
@@ -1,11 +1,3 @@
-#sonata_page_api:
-# resource: '@SonataPageBundle/Resources/config/routing/api.xml'
-# prefix: /
-
-#sonata_page_cache:
-# resource: '@SonataPageBundle/Resources/config/routing/cache.xml'
-# prefix: /
-
sonata_page_exceptions:
resource: '@SonataPageBundle/Resources/config/routing/exceptions.xml'
prefix: /
diff --git a/sonata-project/page-bundle/4.0/post-install.txt b/sonata-project/page-bundle/4.0/post-install.txt
new file mode 100644
index 00000000..51058e42
--- /dev/null
+++ b/sonata-project/page-bundle/4.0/post-install.txt
@@ -0,0 +1,13 @@
+ * Your Page is almost ready:
+ 1. Generate a migration for Sonata Page Database php bin/console doctrine:migrations:diff
+
+ If you use Doctrine Attribute Reference, You must change Sonata Entities generated in Entity folder.
+ You can check more details at https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/attributes-reference.html
+
+ You can also use Rector to refactor, check more details at https://getrector.org/blog/how-to-upgrade-annotations-to-attributes
+
+ 2. Apply the migration generated php bin/console doctrine:migrations:migrate --no-interaction
+ 3. Create your first site: bin/console sonata:page:create-site --enabled --name=localhost --locale=- --host=localhost --relativePath=- --enabledFrom=now --enabledTo=- --default
+ After you generate your site, You will see few commands to execute to have your Site ready.
+
+ * Read the documentation at https://docs.sonata-project.org/projects/SonataPageBundle/en/4.x/
diff --git a/sonata-project/page-bundle/3.9/src/Entity/SonataPageBlock.php b/sonata-project/page-bundle/4.0/src/Entity/SonataPageBlock.php
index 417e8b47..b7144825 100644
--- a/sonata-project/page-bundle/3.9/src/Entity/SonataPageBlock.php
+++ b/sonata-project/page-bundle/4.0/src/Entity/SonataPageBlock.php
@@ -5,13 +5,11 @@ declare(strict_types=1);
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
-use JMS\Serializer\Annotation as Serializer;
use Sonata\PageBundle\Entity\BaseBlock;
/**
* @ORM\Entity
* @ORM\Table(name="page__block")
- * @ORM\HasLifecycleCallbacks
*/
class SonataPageBlock extends BaseBlock
{
@@ -19,63 +17,8 @@ class SonataPageBlock extends BaseBlock
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
- * // Serializer\Groups(groups={"sonata_api_read","sonata_api_write","sonata_search"})
*
* @var int
*/
protected $id;
-
- /**
- * @ORM\OneToMany(
- * targetEntity="App\Entity\SonataPageBlock",
- * mappedBy="parent", cascade={"remove", "persist"}, orphanRemoval=true
- * )
- * @ORM\OrderBy({"position"="ASC"})
- *
- * @var SonataPageBlock[]
- */
- protected $children;
-
- /**
- * @ORM\ManyToOne(
- * targetEntity="App\Entity\SonataPageBlock",
- * inversedBy="children"
- * )
- * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
- *
- * @var SonataPageBlock
- */
- protected $parent;
-
- /**
- * @ORM\ManyToOne(
- * targetEntity="App\Entity\SonataPagePage",
- * inversedBy="blocks", cascade={"persist"}
- * )
- * @ORM\JoinColumn(name="page_id", referencedColumnName="id", onDelete="CASCADE")
- *
- * @var SonataPagePage
- */
- protected $page;
-
- public function getId()
- {
- return $this->id;
- }
-
- /**
- * @ORM\PrePersist
- */
- public function prePersist(): void
- {
- parent::prePersist();
- }
-
- /**
- * @ORM\PreUpdate
- */
- public function preUpdate(): void
- {
- parent::preUpdate();
- }
}
diff --git a/sonata-project/page-bundle/3.9/src/Entity/SonataPagePage.php b/sonata-project/page-bundle/4.0/src/Entity/SonataPagePage.php
index b9f2fbdd..eed26221 100644
--- a/sonata-project/page-bundle/3.9/src/Entity/SonataPagePage.php
+++ b/sonata-project/page-bundle/4.0/src/Entity/SonataPagePage.php
@@ -5,13 +5,11 @@ declare(strict_types=1);
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
-use JMS\Serializer\Annotation as Serializer;
use Sonata\PageBundle\Entity\BasePage;
/**
* @ORM\Entity
* @ORM\Table(name="page__page")
- * @ORM\HasLifecycleCallbacks
*/
class SonataPagePage extends BasePage
{
@@ -19,95 +17,8 @@ class SonataPagePage extends BasePage
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
- * // Serializer\Groups(groups={"sonata_api_read","sonata_api_write","sonata_search"})
*
* @var int
*/
protected $id;
-
- /**
- * @ORM\OneToMany(
- * targetEntity="App\Entity\SonataPagePage",
- * mappedBy="parent", cascade={"persist"}, orphanRemoval=false
- * )
- * @ORM\OrderBy({"position"="ASC"})
- *
- * @var SonataPagePage[]
- */
- protected $children;
-
- /**
- * @ORM\OneToMany(
- * targetEntity="App\Entity\SonataPageBlock",
- * mappedBy="page", cascade={"remove", "persist", "refresh", "merge", "detach"}, orphanRemoval=false
- * )
- * @ORM\OrderBy({"position"="ASC"})
- *
- * @var SonataPageBlock[]
- */
- protected $blocks;
-
- /**
- * @ORM\ManyToOne(
- * targetEntity="App\Entity\SonataPageSite",
- * cascade={"persist"}
- * )
- * @ORM\JoinColumn(name="site_id", referencedColumnName="id", onDelete="CASCADE")
- *
- * @var SonataPageSite
- */
- protected $site;
-
- /**
- * @ORM\ManyToOne(
- * targetEntity="App\Entity\SonataPagePage",
- * inversedBy="children", cascade={"persist"}
- * )
- * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
- *
- * @var SonataPagePage
- */
- protected $parent;
-
- /**
- * @ORM\OneToMany(
- * targetEntity="App\Entity\SonataPagePage",
- * mappedBy="target", orphanRemoval=false
- * )
- *
- * @var SonataPagePage[]
- */
- protected $sources;
-
- /**
- * @ORM\ManyToOne(
- * targetEntity="App\Entity\SonataPagePage",
- * inversedBy="sources", cascade={"persist"}
- * )
- * @ORM\JoinColumn(name="target_id", referencedColumnName="id", onDelete="CASCADE")
- *
- * @var SonataPagePage
- */
- protected $target;
-
- public function getId()
- {
- return $this->id;
- }
-
- /**
- * @ORM\PrePersist
- */
- public function prePersist(): void
- {
- parent::prePersist();
- }
-
- /**
- * @ORM\PreUpdate
- */
- public function preUpdate(): void
- {
- parent::preUpdate();
- }
}
diff --git a/sonata-project/page-bundle/3.9/src/Entity/SonataPageSite.php b/sonata-project/page-bundle/4.0/src/Entity/SonataPageSite.php
index 9d2b688a..7a195aac 100644
--- a/sonata-project/page-bundle/3.9/src/Entity/SonataPageSite.php
+++ b/sonata-project/page-bundle/4.0/src/Entity/SonataPageSite.php
@@ -5,13 +5,11 @@ declare(strict_types=1);
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
-use JMS\Serializer\Annotation as Serializer;
use Sonata\PageBundle\Entity\BaseSite;
/**
* @ORM\Entity
* @ORM\Table(name="page__site")
- * @ORM\HasLifecycleCallbacks
*/
class SonataPageSite extends BaseSite
{
@@ -19,30 +17,8 @@ class SonataPageSite extends BaseSite
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
- * \\ Serializer\Groups(groups={"sonata_api_read","sonata_api_write","sonata_search"})
*
* @var int
*/
protected $id;
-
- public function getId()
- {
- return $this->id;
- }
-
- /**
- * @ORM\PrePersist
- */
- public function prePersist(): void
- {
- parent::prePersist();
- }
-
- /**
- * @ORM\PreUpdate
- */
- public function preUpdate(): void
- {
- parent::preUpdate();
- }
}
diff --git a/sonata-project/page-bundle/3.9/src/Entity/SonataPageSnapshot.php b/sonata-project/page-bundle/4.0/src/Entity/SonataPageSnapshot.php
index 9560a863..bbd3637d 100644
--- a/sonata-project/page-bundle/3.9/src/Entity/SonataPageSnapshot.php
+++ b/sonata-project/page-bundle/4.0/src/Entity/SonataPageSnapshot.php
@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
-use JMS\Serializer\Annotation as Serializer;
use Sonata\PageBundle\Entity\BaseSnapshot;
/**
@@ -22,36 +21,8 @@ class SonataPageSnapshot extends BaseSnapshot
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
- * // Serializer\Groups(groups={"sonata_api_read","sonata_api_write","sonata_search"})
*
* @var int
*/
protected $id;
-
- /**
- * @ORM\ManyToOne(
- * targetEntity="App\Entity\SonataPageSite",
- * cascade={"persist"}
- * )
- * @ORM\JoinColumn(name="site_id", referencedColumnName="id", onDelete="CASCADE")
- *
- * @var SonataPageSite
- */
- protected $site;
-
- /**
- * @ORM\ManyToOne(
- * targetEntity="App\Entity\SonataPagePage",
- * cascade={"persist"}
- * )
- * @ORM\JoinColumn(name="page_id", referencedColumnName="id", onDelete="CASCADE")
- *
- * @var SonataPagePage
- */
- protected $page;
-
- public function getId()
- {
- return $this->id;
- }
} |
sonata-project/page-bundle/4.0/src/Entity/SonataPageSnapshot.php
Outdated
Show resolved
Hide resolved
Head branch was pushed to by a user without write access
3923c8c
to
1cfac61
Compare
Hey @jordisala1991 for page bundle works I need to add SonataDoctrineOrmAdminBundle https://docs.sonata-project.org/projects/SonataPageBundle/en/4.x/reference/installation/ do you know anyway to check if this dependency was added if not ask if the user wants to install? |
IMHO, it's the user job to require DoctrineORM so you don't need anything else. |
sonata-project/page-bundle/4.0/config/packages/sonata_page.yaml
Outdated
Show resolved
Hide resolved
Head branch was pushed to by a user without write access
3dc3174
Head branch was pushed to by a user without write access
3dc3174
to
b5ae694
Compare
Pull request was converted to draft
6d599c4
to
25874df
Compare
25874df
to
969b323
Compare
Hey @VincentLanglet and @jordisala1991 , after the user install Sonata Page bundle, it'll be the next steps to execute to have this working! What do you think? |
That's nice, let see if someone can merge this |
@jordisala1991 could you give your approval again pleases 🙏 |
He's really busy atm ; and the approval will not really help moving this PR forward. |