11
11
12
12
namespace ApiPlatform \Core \Bridge \Doctrine \Orm ;
13
13
14
- use ApiPlatform \Core \Api \ItemDataProviderInterface ;
15
14
use ApiPlatform \Core \Bridge \Doctrine \Orm \Extension \QueryItemExtensionInterface ;
15
+ use ApiPlatform \Core \DataProvider \ItemDataProviderInterface ;
16
16
use ApiPlatform \Core \Exception \InvalidArgumentException ;
17
17
use ApiPlatform \Core \Exception \ResourceClassNotSupportedException ;
18
18
use ApiPlatform \Core \Metadata \Property \Factory \PropertyMetadataFactoryInterface ;
@@ -33,37 +33,26 @@ class ItemDataProvider implements ItemDataProviderInterface
33
33
private $ propertyNameCollectionFactory ;
34
34
private $ propertyMetadataFactory ;
35
35
private $ itemExtensions ;
36
- private $ decorated ;
37
36
38
37
/**
39
38
* @param ManagerRegistry $managerRegistry
40
39
* @param PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory
41
40
* @param PropertyMetadataFactoryInterface $propertyMetadataFactory
42
41
* @param QueryItemExtensionInterface[] $itemExtensions
43
- * @param ItemDataProviderInterface|null $decorated
44
42
*/
45
- public function __construct (ManagerRegistry $ managerRegistry , PropertyNameCollectionFactoryInterface $ propertyNameCollectionFactory , PropertyMetadataFactoryInterface $ propertyMetadataFactory , array $ itemExtensions = [], ItemDataProviderInterface $ decorated = null )
43
+ public function __construct (ManagerRegistry $ managerRegistry , PropertyNameCollectionFactoryInterface $ propertyNameCollectionFactory , PropertyMetadataFactoryInterface $ propertyMetadataFactory , array $ itemExtensions = [])
46
44
{
47
45
$ this ->managerRegistry = $ managerRegistry ;
48
46
$ this ->propertyNameCollectionFactory = $ propertyNameCollectionFactory ;
49
47
$ this ->propertyMetadataFactory = $ propertyMetadataFactory ;
50
48
$ this ->itemExtensions = $ itemExtensions ;
51
- $ this ->decorated = $ decorated ;
52
49
}
53
50
54
51
/**
55
52
* {@inheritdoc}
56
53
*/
57
54
public function getItem (string $ resourceClass , $ id , string $ operationName = null , bool $ fetchData = false )
58
55
{
59
- if ($ this ->decorated ) {
60
- try {
61
- return $ this ->decorated ->getItem ($ resourceClass , $ id , $ operationName , $ fetchData );
62
- } catch (ResourceClassNotSupportedException $ resourceClassNotSupportedException ) {
63
- // Ignore it
64
- }
65
- }
66
-
67
56
$ manager = $ this ->managerRegistry ->getManagerForClass ($ resourceClass );
68
57
if (null === $ manager ) {
69
58
throw new ResourceClassNotSupportedException ();
0 commit comments