Skip to content

Commit

Permalink
Revert "Adding cycle/annotated 4.0 support (#74)"
Browse files Browse the repository at this point in the history
This reverts commit 936b512.
  • Loading branch information
msmakouz committed Oct 27, 2023
1 parent 936b512 commit 8e743e1
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 279 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"require": {
"php": ">=8.1",
"cycle/annotated": "^4.0",
"cycle/annotated": "^3.1",
"cycle/migrations": "^4.0.1",
"cycle/orm": "^2.0.2",
"cycle/schema-migrations-generator": "^2.1",
Expand Down
53 changes: 0 additions & 53 deletions src/Annotated/Locator/ListenerEmbeddingsLocator.php

This file was deleted.

54 changes: 0 additions & 54 deletions src/Annotated/Locator/ListenerEntityLocator.php

This file was deleted.

34 changes: 9 additions & 25 deletions src/Bootloader/AnnotatedBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
use Spiral\Attributes\ReaderInterface;
use Spiral\Boot\Bootloader\Bootloader;
use Spiral\Bootloader\Attributes\AttributesBootloader;
use Spiral\Cycle\Annotated\Locator\ListenerEmbeddingsLocator;
use Spiral\Cycle\Annotated\Locator\ListenerEntityLocator;
use Spiral\Tokenizer\Bootloader\TokenizerListenerBootloader;
use Spiral\Tokenizer\Bootloader\TokenizerBootloader;
use Spiral\Tokenizer\ClassesInterface;

final class AnnotatedBootloader extends Bootloader
{
protected const DEPENDENCIES = [
SchemaBootloader::class,
TokenizerListenerBootloader::class,
TokenizerBootloader::class,
AttributesBootloader::class,
];

Expand All @@ -28,11 +27,6 @@ final class AnnotatedBootloader extends Bootloader
Annotated\MergeIndexes::class => [self::class, 'initMergeIndexes'],
];

protected const SINGLETONS = [
ListenerEntityLocator::class => ListenerEntityLocator::class,
ListenerEmbeddingsLocator::class => ListenerEmbeddingsLocator::class,
];

public function init(SchemaBootloader $schema): void
{
$schema->addGenerator(SchemaBootloader::GROUP_INDEX, Annotated\Embeddings::class);
Expand All @@ -42,25 +36,14 @@ public function init(SchemaBootloader $schema): void
$schema->addGenerator(SchemaBootloader::GROUP_RENDER, Annotated\MergeIndexes::class);
}

public function boot(
TokenizerListenerBootloader $tokenizer,
ListenerEntityLocator $entityLocator,
ListenerEmbeddingsLocator $embeddingsLocator
): void {
$tokenizer->addListener($entityLocator);
$tokenizer->addListener($embeddingsLocator);
}

private function initEmbeddings(
ReaderInterface $reader,
ListenerEmbeddingsLocator $embeddingsLocator
): Annotated\Embeddings {
return new Annotated\Embeddings($embeddingsLocator, $reader);
private function initEmbeddings(ClassesInterface $classes, ReaderInterface $reader): Annotated\Embeddings
{
return new Annotated\Embeddings($classes, $reader);
}

public function initEntities(ReaderInterface $reader, ListenerEntityLocator $entityLocator): Annotated\Entities
public function initEntities(ClassesInterface $classes, ReaderInterface $reader): Annotated\Entities
{
return new Annotated\Entities($entityLocator, $reader);
return new Annotated\Entities($classes, $reader);
}

public function initMergeColumns(ReaderInterface $reader): Annotated\MergeColumns
Expand All @@ -78,3 +61,4 @@ public function initMergeIndexes(ReaderInterface $reader): Annotated\MergeIndexe
return new Annotated\MergeIndexes($reader);
}
}

7 changes: 3 additions & 4 deletions src/Bootloader/PrototypeBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@
use Cycle\ORM;
use Doctrine\Inflector\Rules\English\InflectorFactory;
use Psr\Container\ContainerInterface;
use Spiral\Boot\AbstractKernel;
use Spiral\Boot\Bootloader\Bootloader;
use Spiral\Prototype\Bootloader\PrototypeBootloader as BasePrototypeBootloader;

final class PrototypeBootloader extends Bootloader
{
public function boot(AbstractKernel $kernel): void
public function boot(BasePrototypeBootloader $prototype, ContainerInterface $container): void
{
$kernel->bootstrapped($this->bindDatabase(...));
$kernel->bootstrapped($this->bindCycle(...));
$this->bindDatabase($prototype);
$this->bindCycle($prototype, $container);
}

private function bindDatabase(BasePrototypeBootloader $prototype): void
Expand Down
21 changes: 0 additions & 21 deletions tests/app/Entities/Address.php

This file was deleted.

53 changes: 0 additions & 53 deletions tests/src/Annotated/Locator/ListenerEmbeddingsLocatorTest.php

This file was deleted.

52 changes: 0 additions & 52 deletions tests/src/Annotated/Locator/ListenerEntityLocatorTest.php

This file was deleted.

12 changes: 0 additions & 12 deletions tests/src/Bootloader/AnnotatedBootloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use Cycle\Annotated;
use Cycle\Schema\GeneratorInterface;
use Spiral\Attributes\ReaderInterface;
use Spiral\Cycle\Annotated\Locator\ListenerEmbeddingsLocator;
use Spiral\Cycle\Annotated\Locator\ListenerEntityLocator;
use Spiral\Tests\BaseTest;

final class AnnotatedBootloaderTest extends BaseTest
Expand Down Expand Up @@ -42,14 +40,4 @@ public function testGetsAnnotatedMergeIndexes(): void
{
$this->assertContainerBound(Annotated\MergeIndexes::class, GeneratorInterface::class);
}

public function testGetsListenerEntityLocator(): void
{
$this->assertContainerBoundAsSingleton(ListenerEntityLocator::class, ListenerEntityLocator::class);
}

public function testGetsListenerEmbeddingsLocator(): void
{
$this->assertContainerBoundAsSingleton(ListenerEmbeddingsLocator::class, ListenerEmbeddingsLocator::class);
}
}
4 changes: 0 additions & 4 deletions tests/src/Console/Command/CycleOrm/MigrateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Cycle\Annotated\Annotation\Entity;
use Cycle\ORM\SchemaInterface;
use Spiral\Boot\MemoryInterface;
use Spiral\Cycle\Annotated\Locator\ListenerEntityLocator;
use Spiral\Cycle\Config\CycleConfig;
use Spiral\Files\Files;
use Spiral\Tests\ConsoleTest;
Expand Down Expand Up @@ -77,9 +76,6 @@ class Tag
PHP
);

$listener = $this->getContainer()->get(ListenerEntityLocator::class);
$listener->listen(new \ReflectionClass(\Spiral\App\Entities\Tag::class));

$this->assertConsoleCommandOutputContainsStrings('cycle:migrate', ['-r' => true], [
'default.tags',
'create table',
Expand Down

0 comments on commit 8e743e1

Please sign in to comment.