-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Add support for BlockBundle 4.x #522
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2e56fb1
Add support for BlockBundle 4.x
wbloszyk 949f218
Fix
wbloszyk 36511c9
Fix
wbloszyk efe6e05
Fix
wbloszyk 47df384
Fix
wbloszyk 8b2c38e
Fix
wbloszyk ee007c0
Fix
wbloszyk a6bad5d
Fix
wbloszyk 4fb4475
Check admin upgrade
wbloszyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Twig\Environment; | ||
|
||
/** | ||
* @author Christian Gripp <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -17,17 +17,21 @@ | |||||||
use Sonata\AdminBundle\Admin\AdminInterface; | ||||||||
use Sonata\AdminBundle\Form\FormMapper; | ||||||||
use Sonata\AdminBundle\Form\Type\ModelTypeList; | ||||||||
use Sonata\BlockBundle\Block\Service\AbstractAdminBlockService; | ||||||||
use Sonata\BlockBundle\Block\Service\AbstractBlockService; | ||||||||
use Sonata\BlockBundle\Block\Service\AdminBlockServiceInterface; | ||||||||
use Sonata\BlockBundle\Meta\Metadata; | ||||||||
use Sonata\BlockBundle\Model\BlockInterface; | ||||||||
use Sonata\ClassificationBundle\Model\ContextInterface; | ||||||||
use Sonata\ClassificationBundle\Model\ContextManagerInterface; | ||||||||
use Sonata\CoreBundle\Validator\ErrorElement; | ||||||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; | ||||||||
use Symfony\Component\Form\FormBuilder; | ||||||||
use Twig\Environment; | ||||||||
|
||||||||
/** | ||||||||
* @author Christian Gripp <[email protected]> | ||||||||
*/ | ||||||||
abstract class AbstractClassificationBlockService extends AbstractAdminBlockService | ||||||||
abstract class AbstractClassificationBlockService extends AbstractBlockService | ||||||||
{ | ||||||||
/** | ||||||||
* @var ContextManagerInterface | ||||||||
|
@@ -44,6 +48,15 @@ public function __construct( | |||||||
$contextManagerOrDeprecatedTemplating, | ||||||||
$deprecatedContextManager = null | ||||||||
) { | ||||||||
// NEXT_MAJOR: remove the if block | ||||||||
if (!interface_exists(AdminBlockServiceInterface::class)) { | ||||||||
@trigger_error( | ||||||||
'The '.__NAMESPACE__.'\EditableBlockService interface is required since sonata-project/block-bundle 4.0 '. | ||||||||
'You must add it to you '.__CLASS__.'.', | ||||||||
E_USER_DEPRECATED | ||||||||
); | ||||||||
} | ||||||||
|
||||||||
// NEXT_MAJOR: remove the if block | ||||||||
if (\is_string($twigOrDeprecatedName)) { | ||||||||
parent::__construct($twigOrDeprecatedName, $contextManagerOrDeprecatedTemplating); | ||||||||
|
@@ -56,6 +69,98 @@ public function __construct( | |||||||
} | ||||||||
} | ||||||||
|
||||||||
/** | ||||||||
* NEXT_MAJOR: Remove this method. | ||||||||
* | ||||||||
* @deprecated since sonata-project/block-bundle 3.16, to be removed in version 4.0. | ||||||||
*/ | ||||||||
public function prePersist(BlockInterface $block) | ||||||||
{ | ||||||||
} | ||||||||
|
||||||||
/** | ||||||||
* NEXT_MAJOR: Remove this method. | ||||||||
* | ||||||||
* @deprecated since sonata-project/block-bundle 3.16, to be removed in version 4.0. | ||||||||
*/ | ||||||||
public function postPersist(BlockInterface $block) | ||||||||
{ | ||||||||
} | ||||||||
|
||||||||
/** | ||||||||
* NEXT_MAJOR: Remove this method. | ||||||||
* | ||||||||
* @deprecated since sonata-project/block-bundle 3.16, to be removed in version 4.0. | ||||||||
*/ | ||||||||
public function preUpdate(BlockInterface $block) | ||||||||
{ | ||||||||
} | ||||||||
|
||||||||
/** | ||||||||
* NEXT_MAJOR: Remove this method. | ||||||||
* | ||||||||
* @deprecated since sonata-project/block-bundle 3.16, to be removed in version 4.0. | ||||||||
*/ | ||||||||
public function postUpdate(BlockInterface $block) | ||||||||
{ | ||||||||
} | ||||||||
|
||||||||
/** | ||||||||
* NEXT_MAJOR: Remove this method. | ||||||||
* | ||||||||
* @deprecated since sonata-project/block-bundle 3.16, to be removed in version 4.0. | ||||||||
*/ | ||||||||
public function preRemove(BlockInterface $block) | ||||||||
{ | ||||||||
} | ||||||||
|
||||||||
/** | ||||||||
* NEXT_MAJOR: Remove this method. | ||||||||
* | ||||||||
* @deprecated since sonata-project/block-bundle 3.16, to be removed in version 4.0. | ||||||||
*/ | ||||||||
public function postRemove(BlockInterface $block) | ||||||||
{ | ||||||||
} | ||||||||
|
||||||||
/** | ||||||||
* NEXT_MAJOR: Remove this method. | ||||||||
* | ||||||||
* @deprecated since sonata-project/block-bundle 3.16, to be removed in version 4.0. | ||||||||
*/ | ||||||||
public function buildCreateForm(FormMapper $formMapper, BlockInterface $block) | ||||||||
{ | ||||||||
$this->buildEditForm($formMapper, $block); | ||||||||
} | ||||||||
|
||||||||
/** | ||||||||
* NEXT_MAJOR: Remove this method. | ||||||||
* | ||||||||
* @deprecated since sonata-project/block-bundle 3.16, to be removed in version 4.0. | ||||||||
*/ | ||||||||
public function buildEditForm(FormMapper $form, BlockInterface $block) | ||||||||
{ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is AbstractAdminBlockService method, we should not change them. Self reference method make infinity loop. |
||||||||
} | ||||||||
|
||||||||
/** | ||||||||
* NEXT_MAJOR: Remove this method. | ||||||||
* | ||||||||
* @deprecated since sonata-project/block-bundle 3.16, to be removed in version 4.0. | ||||||||
*/ | ||||||||
public function validateBlock(ErrorElement $errorElement, BlockInterface $block) | ||||||||
{ | ||||||||
} | ||||||||
|
||||||||
/** | ||||||||
* NEXT_MAJOR: Remove this method. | ||||||||
* | ||||||||
* @deprecated since sonata-project/block-bundle 3.16, to be removed in version 4.0. | ||||||||
*/ | ||||||||
public function getBlockMetadata($code = null) | ||||||||
{ | ||||||||
return new Metadata($this->getName(), (null !== $code ? $code : $this->getName()), false, 'SonataBlockBundle', ['class' => 'fa fa-file']); | ||||||||
} | ||||||||
|
||||||||
/** | ||||||||
* @param string $formField | ||||||||
* @param string $field | ||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Twig\Environment; | ||
|
||
/** | ||
* @author Christian Gripp <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Twig\Environment; | ||
|
||
/** | ||
* @author Christian Gripp <[email protected]> | ||
|
@@ -44,11 +45,11 @@ abstract class AbstractTagsBlockService extends AbstractClassificationBlockServi | |
private $tagAdmin; | ||
|
||
/** | ||
* @param string|Environment $twigOrDeprecatedName | ||
* @param EngineInterface|ContextManagerInterface $contextManagerOrDeprecatedTemplating | ||
* @param ContextManagerInterface|TagManagerInterface| $tagManagerOrDeprecatedContextManager | ||
* @param TagManagerInterface|AdminInterface $tagAdminOrDeprecatedTagManager | ||
* @param AdminInterface|null $deprecatedTagAdmin | ||
* @param string|Environment $twigOrDeprecatedName | ||
* @param EngineInterface|ContextManagerInterface $contextManagerOrDeprecatedTemplating | ||
* @param ContextManagerInterface|TagManagerInterface $tagManagerOrDeprecatedContextManager | ||
* @param TagManagerInterface|AdminInterface $tagAdminOrDeprecatedTagManager | ||
* @param AdminInterface|null $deprecatedTagAdmin | ||
*/ | ||
public function __construct( | ||
$twigOrDeprecatedName, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not add this to the stable branch