Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

namespace ApiPlatform\Doctrine\Odm\Metadata\Resource;

use ApiPlatform\Doctrine\Common\State\PersistProcessor;
use ApiPlatform\Doctrine\Common\State\RemoveProcessor;
use ApiPlatform\Doctrine\Odm\State\CollectionProvider;
use ApiPlatform\Doctrine\Odm\State\ItemProvider;
use ApiPlatform\Metadata\CollectionOperationInterface;
Expand Down Expand Up @@ -110,9 +108,9 @@ private function getProvider(Operation $operation): string
private function getProcessor(Operation $operation): string
{
if ($operation instanceof DeleteOperationInterface) {
return RemoveProcessor::class;
return 'api_platform.doctrine_mongodb.odm.state.remove_processor';
}

return PersistProcessor::class;
return 'api_platform.doctrine_mongodb.odm.state.persist_processor';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

namespace ApiPlatform\Doctrine\Orm\Metadata\Resource;

use ApiPlatform\Doctrine\Common\State\PersistProcessor;
use ApiPlatform\Doctrine\Common\State\RemoveProcessor;
use ApiPlatform\Doctrine\Orm\State\CollectionProvider;
use ApiPlatform\Doctrine\Orm\State\ItemProvider;
use ApiPlatform\Metadata\CollectionOperationInterface;
Expand Down Expand Up @@ -110,9 +108,9 @@ private function getProvider(Operation $operation): string
private function getProcessor(Operation $operation): string
{
if ($operation instanceof DeleteOperationInterface) {
return RemoveProcessor::class;
return 'api_platform.doctrine.orm.state.remove_processor';
}

return PersistProcessor::class;
return 'api_platform.doctrine.orm.state.persist_processor';
}
}
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/Resources/config/doctrine_mongodb_odm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@
<argument type="service" id="doctrine_mongodb" />

<tag name="api_platform.state_processor" priority="-100" key="ApiPlatform\Doctrine\Common\State\RemoveProcessor" />
<tag name="api_platform.state_processor" priority="-100" key="api_platform.doctrine_mongodb.odm.state.remove_processor" />
</service>
<service id="ApiPlatform\Doctrine\Common\State\RemoveProcessor" alias="api_platform.doctrine_mongodb.odm.state.remove_processor" />

<service id="api_platform.doctrine_mongodb.odm.state.persist_processor" class="ApiPlatform\Doctrine\Common\State\PersistProcessor">
<argument type="service" id="doctrine_mongodb" />

<tag name="api_platform.state_processor" priority="-100" key="ApiPlatform\Doctrine\Common\State\PersistProcessor" />
<tag name="api_platform.state_processor" priority="-100" key="api_platform.doctrine_mongodb.odm.state.persist_processor" />
</service>
<service id="ApiPlatform\Doctrine\Common\State\PersistProcessor" alias="api_platform.doctrine_mongodb.odm.state.persist_processor" />

Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/Resources/config/doctrine_orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
<argument type="service" id="doctrine" />

<tag name="api_platform.state_processor" priority="-100" key="ApiPlatform\Doctrine\Common\State\RemoveProcessor" />
<tag name="api_platform.state_processor" priority="-100" key="api_platform.doctrine.orm.state.remove_processor" />
</service>
<service id="ApiPlatform\Doctrine\Common\State\RemoveProcessor" alias="api_platform.doctrine.orm.state.remove_processor" />

<service id="api_platform.doctrine.orm.state.persist_processor" class="ApiPlatform\Doctrine\Common\State\PersistProcessor">
<argument type="service" id="doctrine" />

<tag name="api_platform.state_processor" priority="-100" key="ApiPlatform\Doctrine\Common\State\PersistProcessor" />
<tag name="api_platform.state_processor" priority="-100" key="api_platform.doctrine.orm.state.persist_processor" />
</service>
<service id="ApiPlatform\Doctrine\Common\State\PersistProcessor" alias="api_platform.doctrine.orm.state.persist_processor" />
</services>
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/Resources/config/v3/doctrine_odm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<argument type="tagged" tag="api_platform.doctrine_mongodb.odm.aggregation_extension.collection" />

<tag name="api_platform.state_provider" priority="-100" key="ApiPlatform\Doctrine\Odm\State\CollectionProvider" />
<tag name="api_platform.state_provider" priority="-100" key="api_platform.doctrine_mongodb.odm.state.collection_provider" />
</service>
<service id="ApiPlatform\Doctrine\Odm\State\CollectionProvider" alias="api_platform.doctrine_mongodb.odm.state.collection_provider" />

Expand All @@ -29,6 +30,7 @@
<argument type="tagged" tag="api_platform.doctrine_mongodb.odm.aggregation_extension.item" />

<tag name="api_platform.state_provider" priority="-100" key="ApiPlatform\Doctrine\Odm\State\ItemProvider" />
<tag name="api_platform.state_provider" priority="-100" key="api_platform.doctrine_mongodb.odm.state.item_provider" />
</service>
<service id="ApiPlatform\Doctrine\Odm\State\ItemProvider" alias="api_platform.doctrine_mongodb.odm.state.item_provider" />

Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/Resources/config/v3/doctrine_orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<argument type="tagged" tag="api_platform.doctrine.orm.query_extension.collection" />

<tag name="api_platform.state_provider" priority="-100" key="ApiPlatform\Doctrine\Orm\State\CollectionProvider" />
<tag name="api_platform.state_provider" priority="-100" key="api_platform.doctrine.orm.state.collection_provider" />
</service>
<service id="ApiPlatform\Doctrine\Orm\State\CollectionProvider" alias="api_platform.doctrine.orm.state.collection_provider" />

Expand All @@ -28,6 +29,7 @@
<argument type="tagged" tag="api_platform.doctrine.orm.query_extension.item" />

<tag name="api_platform.state_provider" priority="-100" key="ApiPlatform\Doctrine\Orm\State\ItemProvider" />
<tag name="api_platform.state_provider" priority="-100" key="api_platform.doctrine.orm.state.item_provider" />
</service>
<service id="ApiPlatform\Doctrine\Orm\State\ItemProvider" alias="api_platform.doctrine.orm.state.item_provider" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
namespace ApiPlatform\Tests\Doctrine\Odm\Metadata\Resource;

use ApiPlatform\Core\Tests\ProphecyTrait;
use ApiPlatform\Doctrine\Common\State\PersistProcessor;
use ApiPlatform\Doctrine\Common\State\RemoveProcessor;
use ApiPlatform\Doctrine\Odm\Metadata\Resource\DoctrineMongoDbOdmResourceCollectionMetadataFactory;
use ApiPlatform\Doctrine\Odm\State\CollectionProvider;
use ApiPlatform\Doctrine\Odm\State\ItemProvider;
Expand Down Expand Up @@ -97,8 +95,8 @@ public function operationProvider(): iterable
$default = (new Get())->withName('get')->withClass(Dummy::class);

yield [(new Get())->withProvider('has a provider')->withProcessor('and a processor')->withOperation($default), 'has a provider', 'and a processor'];
yield [(new Get())->withOperation($default), ItemProvider::class, PersistProcessor::class];
yield [(new GetCollection())->withOperation($default), CollectionProvider::class, PersistProcessor::class];
yield [(new Delete())->withOperation($default), ItemProvider::class, RemoveProcessor::class];
yield [(new Get())->withOperation($default), ItemProvider::class, 'api_platform.doctrine_mongodb.odm.state.persist_processor'];
yield [(new GetCollection())->withOperation($default), CollectionProvider::class, 'api_platform.doctrine_mongodb.odm.state.persist_processor'];
yield [(new Delete())->withOperation($default), ItemProvider::class, 'api_platform.doctrine_mongodb.odm.state.remove_processor'];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
namespace ApiPlatform\Tests\Doctrine\Orm\Metadata\Resource;

use ApiPlatform\Core\Tests\ProphecyTrait;
use ApiPlatform\Doctrine\Common\State\PersistProcessor;
use ApiPlatform\Doctrine\Common\State\RemoveProcessor;
use ApiPlatform\Doctrine\Orm\Metadata\Resource\DoctrineOrmResourceCollectionMetadataFactory;
use ApiPlatform\Doctrine\Orm\State\CollectionProvider;
use ApiPlatform\Doctrine\Orm\State\ItemProvider;
Expand Down Expand Up @@ -85,8 +83,8 @@ public function operationProvider(): iterable
$default = (new Get())->withName('get')->withClass(Dummy::class);

yield [(new Get())->withProvider('has a provider')->withProcessor('and a processor')->withOperation($default), 'has a provider', 'and a processor'];
yield [(new Get())->withOperation($default), ItemProvider::class, PersistProcessor::class];
yield [(new GetCollection())->withOperation($default), CollectionProvider::class, PersistProcessor::class];
yield [(new Delete())->withOperation($default), ItemProvider::class, RemoveProcessor::class];
yield [(new Get())->withOperation($default), ItemProvider::class, 'api_platform.doctrine.orm.state.persist_processor'];
yield [(new GetCollection())->withOperation($default), CollectionProvider::class, 'api_platform.doctrine.orm.state.persist_processor'];
yield [(new Delete())->withOperation($default), ItemProvider::class, 'api_platform.doctrine.orm.state.remove_processor'];
}
}