File tree Expand file tree Collapse file tree 4 files changed +14
-87
lines changed
tests/Fixtures/TestBundle/Entity Expand file tree Collapse file tree 4 files changed +14
-87
lines changed Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ Feature: Subresource support
12
12
And the JSON should be equal to:
13
13
"""
14
14
{
15
- "@context": "/contexts/Answer",
16
- "@id": "/answers/1",
17
- "@type": "Answer",
18
- "id": 1,
19
- "content": "42",
20
- "question": "/questions/1"
15
+ "@context": "\ /contexts\ /Answer",
16
+ "@id": "\ /answers\ /1",
17
+ "@type": "Answer",
18
+ "id": 1,
19
+ "content": "42",
20
+ "question": "\ /questions\ /1"
21
21
}
22
22
"""
23
23
Original file line number Diff line number Diff line change 16
16
use ApiPlatform \Core \Annotation \ApiProperty ;
17
17
use ApiPlatform \Core \Annotation \ApiResource ;
18
18
use Doctrine \Common \Collections \ArrayCollection ;
19
+ use Doctrine \Common \Collections \Collection ;
19
20
use Doctrine \ORM \Mapping as ORM ;
20
21
21
22
/**
@@ -58,61 +59,31 @@ public function __construct()
58
59
$ this ->offers = new ArrayCollection ();
59
60
}
60
61
61
- /**
62
- * Get offers.
63
- *
64
- * @return offers
65
- */
66
- public function getOffers (): ArrayCollection
62
+ public function getOffers (): Collection
67
63
{
68
64
return $ this ->offers ;
69
65
}
70
66
71
- /**
72
- * Set offers.
73
- *
74
- * @param offers the value to set
75
- */
76
67
public function setOffers ($ offers )
77
68
{
78
69
$ this ->offers = $ offers ;
79
70
}
80
71
81
- /**
82
- * Add offer.
83
- *
84
- * @param offer the value to add
85
- */
86
72
public function addOffer (DummyOffer $ offer )
87
73
{
88
74
$ this ->offers ->add ($ offer );
89
75
}
90
76
91
- /**
92
- * Get id.
93
- *
94
- * @return id
95
- */
96
- public function getId (): int
77
+ public function getId ()
97
78
{
98
79
return $ this ->id ;
99
80
}
100
81
101
- /**
102
- * Get value.
103
- *
104
- * @return value
105
- */
106
82
public function getValue (): int
107
83
{
108
84
return $ this ->value ;
109
85
}
110
86
111
- /**
112
- * Set value.
113
- *
114
- * @param value the value to set
115
- */
116
87
public function setValue (int $ value )
117
88
{
118
89
$ this ->value = $ value ;
Original file line number Diff line number Diff line change @@ -43,31 +43,16 @@ class DummyOffer
43
43
*/
44
44
private $ value ;
45
45
46
- /**
47
- * Get id.
48
- *
49
- * @return id
50
- */
51
- public function getId (): int
46
+ public function getId ()
52
47
{
53
48
return $ this ->id ;
54
49
}
55
50
56
- /**
57
- * Get value.
58
- *
59
- * @return value
60
- */
61
51
public function getValue (): int
62
52
{
63
53
return $ this ->value ;
64
54
}
65
55
66
- /**
67
- * Set value.
68
- *
69
- * @param value the value to set
70
- */
71
56
public function setValue (int $ value )
72
57
{
73
58
$ this ->value = $ value ;
Original file line number Diff line number Diff line change 16
16
use ApiPlatform \Core \Annotation \ApiProperty ;
17
17
use ApiPlatform \Core \Annotation \ApiResource ;
18
18
use Doctrine \Common \Collections \ArrayCollection ;
19
+ use Doctrine \Common \Collections \Collection ;
19
20
use Doctrine \ORM \Mapping as ORM ;
20
21
21
22
/**
@@ -39,7 +40,7 @@ class DummyProduct
39
40
private $ id ;
40
41
41
42
/**
42
- * @var ArrayCollection
43
+ * @var Collection
43
44
*
44
45
* @ApiProperty(subresource=true)
45
46
* @ORM\OneToMany(targetEntity="DummyAggregateOffer", mappedBy="id", cascade={"persist"})
@@ -58,61 +59,31 @@ public function __construct()
58
59
$ this ->offers = new ArrayCollection ();
59
60
}
60
61
61
- /**
62
- * Get offers.
63
- *
64
- * @return offers
65
- */
66
- public function getOffers (): ArrayCollection
62
+ public function getOffers (): Collection
67
63
{
68
64
return $ this ->offers ;
69
65
}
70
66
71
- /**
72
- * Set offers.
73
- *
74
- * @param offers the value to set
75
- */
76
67
public function setOffers ($ offers )
77
68
{
78
69
$ this ->offers = $ offers ;
79
70
}
80
71
81
- /**
82
- * Add offer.
83
- *
84
- * @param offer the value to add
85
- */
86
72
public function addOffer (DummyAggregateOffer $ offer )
87
73
{
88
74
$ this ->offers ->add ($ offer );
89
75
}
90
76
91
- /**
92
- * Get id.
93
- *
94
- * @return id
95
- */
96
- public function getId (): int
77
+ public function getId ()
97
78
{
98
79
return $ this ->id ;
99
80
}
100
81
101
- /**
102
- * Get name.
103
- *
104
- * @return name
105
- */
106
82
public function getName (): string
107
83
{
108
84
return $ this ->name ;
109
85
}
110
86
111
- /**
112
- * Set name.
113
- *
114
- * @param name the value to set
115
- */
116
87
public function setName ($ name )
117
88
{
118
89
$ this ->name = $ name ;
You can’t perform that action at this time.
0 commit comments