Skip to content

Commit c6675e8

Browse files
committed
feat(doctrine)!: rename MappingContext::__invoke() to load()
1 parent 6640719 commit c6675e8

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/Filesystem/Doctrine/MappingContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public function __construct(private ManagerRegistry $registry, private NodeLifec
3737
*
3838
* @return T
3939
*/
40-
public function __invoke(object|iterable $object): object|iterable
40+
public function load(object|iterable $object): object|iterable
4141
{
4242
if (\is_iterable($object)) {
4343
foreach ($object as $item) {
4444
if (\is_object($item)) {
45-
$this($item);
45+
$this->load($item);
4646
}
4747
}
4848

src/Filesystem/Doctrine/Twig/MappingContextExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ final class MappingContextExtension extends AbstractExtension
2424
public function getFilters(): array
2525
{
2626
return [
27-
new TwigFilter('load_files', [MappingContext::class, '__invoke']),
27+
new TwigFilter('load_files', [MappingContext::class, 'load']),
2828
];
2929
}
3030

3131
public function getFunctions(): array
3232
{
3333
return [
34-
new TwigFunction('load_files', [MappingContext::class, '__invoke']),
34+
new TwigFunction('load_files', [MappingContext::class, 'load']),
3535
];
3636
}
3737
}

tests/Filesystem/Doctrine/DoctrineTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ protected function em(): EntityManagerInterface
5353

5454
protected function loadMappingFor(object $object): object
5555
{
56-
return (self::getContainer()->get(Service::class)->objectFileLoader)($object);
56+
return self::getContainer()->get(Service::class)->objectFileLoader->load($object);
5757
}
5858
}

tests/Filesystem/Doctrine/MappingContextTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ public function can_load_files_for_object(): void
5050
$this->em()->clear();
5151

5252
$fromDb = repository(Entity2::class)->first()->object();
53-
$fromDb = self::getContainer()->get(MappingContext::class)($fromDb);
54-
$fromDb = self::getContainer()->get(MappingContext::class)($fromDb); // ensure multiple calls work
55-
self::getContainer()->get(MappingContext::class)([$fromDb]);
53+
$fromDb = self::getContainer()->get(MappingContext::class)->load($fromDb);
54+
$fromDb = self::getContainer()->get(MappingContext::class)->load($fromDb); // ensure multiple calls work
55+
self::getContainer()->get(MappingContext::class)->load([$fromDb]);
5656

5757
$this->assertInstanceOf(LazyFile::class, $fromDb->getFile1());
5858
$this->assertSame('content1', $fromDb->getFile1()->contents());

0 commit comments

Comments
 (0)