Skip to content

Commit

Permalink
Merge pull request #90 from spiral/feature/entity-behavior-bootloader
Browse files Browse the repository at this point in the history
Add `EntityBehaviorBootloader`
  • Loading branch information
butschster authored Jan 10, 2024
2 parents 696a920 + 386c422 commit e8a0985
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 5 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ jobs:
with:
os: >-
['ubuntu-latest']
php: >-
['8.1', '8.2']
stability: >-
['prefer-lowest', 'prefer-stable']
2 changes: 0 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ jobs:
with:
os: >-
['ubuntu-latest']
php: >-
['8.1']
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"spiral/validator": "^1.5",
"spiral/nyholm-bridge": "^1.3",
"spiral-packages/database-seeder": "^3.1",
"vimeo/psalm": "^4.27"
"vimeo/psalm": "^5.19",
"cycle/entity-behavior": "^1.2"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
19 changes: 19 additions & 0 deletions src/Bootloader/EntityBehaviorBootloader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace Spiral\Cycle\Bootloader;

use Cycle\ORM\Transaction\CommandGeneratorInterface;
use Cycle\ORM\Entity\Behavior\EventDrivenCommandGenerator;
use Spiral\Boot\Bootloader\Bootloader;

final class EntityBehaviorBootloader extends Bootloader
{
public function defineBindings(): array
{
return [
CommandGeneratorInterface::class => EventDrivenCommandGenerator::class,
];
}
}
4 changes: 4 additions & 0 deletions tests/src/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,16 @@ public function defineBootloaders(): array

// Auth
CycleBridge\AuthTokensBootloader::class,

// Validation
CycleBridge\ValidationBootloader::class,

// Scaffolder
CycleBridge\ScaffolderBootloader::class,

// EntityBehavior
CycleBridge\EntityBehaviorBootloader::class,

// App
AppBootloader::class,
];
Expand Down
17 changes: 17 additions & 0 deletions tests/src/Bootloader/EntityBehaviorBootloaderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace Spiral\Tests\Bootloader;

use Cycle\ORM\Entity\Behavior\EventDrivenCommandGenerator;
use Cycle\ORM\Transaction\CommandGeneratorInterface;
use Spiral\Tests\BaseTest;

final class EntityBehaviorBootloaderTest extends BaseTest
{
public function testThatEventDrivenCommandGeneratorIsBound(): void
{
$this->assertContainerBound(CommandGeneratorInterface::class, EventDrivenCommandGenerator::class);
}
}

0 comments on commit e8a0985

Please sign in to comment.