-
-
Notifications
You must be signed in to change notification settings - Fork 915
fix(state): operation argument in provide/process #4712
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
Conversation
use Doctrine\ORM\EntityManagerInterface; | ||
use Doctrine\Persistence\ManagerRegistry; | ||
|
||
class DoctrineOrmResourceCollectionMetadataFactory implements ResourceMetadataCollectionFactoryInterface |
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.
class DoctrineOrmResourceCollectionMetadataFactory implements ResourceMetadataCollectionFactoryInterface | |
final class DoctrineOrmResourceCollectionMetadataFactory implements ResourceMetadataCollectionFactoryInterface |
|
||
class DoctrineOrmResourceCollectionMetadataFactory implements ResourceMetadataCollectionFactoryInterface | ||
{ | ||
private $decorated; |
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.
missing types?
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.
drop php 7.1 and yes if not we can't or as phpdoc
private function getProvider(AbstractOperation $operation): string | ||
{ | ||
if ($operation instanceof CollectionOperationInterface) { | ||
return 'api_platform.doctrine.orm.state.collection_provider'; |
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 alias these services with the FQCN, and use it here. This will remove the hard coupling with Symfony.
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.
I tried just aliasing and it doesn't work with tags + service locators this was a quick fix I need to use the class as id
src/Metadata/AbstractOperation.php
Outdated
|
||
namespace ApiPlatform\Metadata; | ||
|
||
abstract class AbstractOperation |
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.
abstract class AbstractOperation | |
abstract class Operation |
The API will be nicer, and this is consistent with the newest coding convention used in Symfony.
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.
I know right, but we need to rename the current one then
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.
Not an issue as this was never released isn't it?
src/State/CallableProcessor.php
Outdated
use ApiPlatform\Metadata\AbstractOperation; | ||
use Psr\Container\ContainerInterface; | ||
|
||
class CallableProcessor implements ProcessorInterface |
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.
class CallableProcessor implements ProcessorInterface | |
final class CallableProcessor implements ProcessorInterface |
{ | ||
$operation = $context['operation'] ?? null; | ||
exit('hello'); |
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.
🔨
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.
on purpose I need to fix this
use ApiPlatform\Metadata\AbstractOperation; | ||
use ApiPlatform\State\ProcessorInterface; | ||
|
||
class ServiceLocatorProcessor implements ProcessorInterface |
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.
class ServiceLocatorProcessor implements ProcessorInterface | |
final class ServiceLocatorProcessor implements ProcessorInterface |
And as this class doesn't depend on Symfony, it could be placed in the top-level namespace.
d7a9eb2
to
ebb6151
Compare
372bd07
to
6ccbaa3
Compare
Review the state provider and processor interfaces. Move provider/processor on the Operation.