-
-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2536 from dpfaffenbauer/attributes-for-pimcore-mo…
…dels [ResourceBundle] auto registration of pimcore models
- Loading branch information
Showing
14 changed files
with
529 additions
and
95 deletions.
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
7 changes: 7 additions & 0 deletions
7
features/domain/pimcore/pimcore_model_resource_autoregistration.feature
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@domain @pimcore | ||
Feature: Adding a new pimcore Class | ||
|
||
Scenario: Create a new pimcore class | ||
Given there is a pimcore class "Car" | ||
And the definitions parent class is set to "\CoreShop\Behat\Model\Car" | ||
And the class "Car" is registered as Pimcore Resource |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* CoreShop | ||
* | ||
* This source file is available under two different licenses: | ||
* - GNU General Public License version 3 (GPLv3) | ||
* - CoreShop Commercial License (CCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) CoreShop GmbH (https://www.coreshop.org) | ||
* @license https://www.coreshop.org/license GPLv3 and CCL | ||
* | ||
*/ | ||
|
||
namespace CoreShop\Behat\Context\Domain; | ||
|
||
use Behat\Behat\Context\Context; | ||
use CoreShop\Component\Core\Model\CarrierInterface; | ||
use CoreShop\Component\Core\Model\OrderInterface; | ||
use CoreShop\Component\Core\Model\OrderItemInterface; | ||
use CoreShop\Component\Core\Model\ProductInterface; | ||
use CoreShop\Component\Order\Context\CartContextInterface; | ||
use CoreShop\Component\Product\Model\ProductUnitInterface; | ||
use CoreShop\Component\Resource\Metadata\Registry; | ||
use CoreShop\Component\Taxation\Model\TaxItemInterface; | ||
use Pimcore\Model\DataObject\Fieldcollection; | ||
use Symfony\Component\Form\FormInterface; | ||
use Webmozart\Assert\Assert; | ||
|
||
final class ResourceContext implements Context | ||
{ | ||
public function __construct( | ||
private Registry $metadataRegistry, | ||
) { | ||
} | ||
|
||
/** | ||
* @Then /^the (class "[^"]+") is registered as Pimcore Resource$/ | ||
*/ | ||
public function theClassIsRegisteredAsPimcoreResource(): void | ||
{ | ||
$car = $this->metadataRegistry->get('app.car'); | ||
|
||
Assert::eq($car->getClass('model'), 'Pimcore\Model\DataObject\Car'); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* CoreShop | ||
* | ||
* This source file is available under two different licenses: | ||
* - GNU General Public License version 3 (GPLv3) | ||
* - CoreShop Commercial License (CCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) CoreShop GmbH (https://www.coreshop.org) | ||
* @license https://www.coreshop.org/license GPLv3 and CCL | ||
* | ||
*/ | ||
|
||
namespace CoreShop\Behat\Model; | ||
|
||
use CoreShop\Bundle\ResourceBundle\Attribute\AsPimcoreModel; | ||
use CoreShop\Component\Resource\Pimcore\Model\AbstractPimcoreModel; | ||
|
||
#[AsPimcoreModel( | ||
pimcoreModel: 'Pimcore\Model\DataObject\Car', | ||
type: 'object' | ||
)] | ||
class Car extends AbstractPimcoreModel | ||
{ | ||
|
||
} |
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
Oops, something went wrong.