Skip to content

Commit cc0e58a

Browse files
committed
Remove deprecated methods
1 parent 94bb56c commit cc0e58a

File tree

2 files changed

+74
-58
lines changed

2 files changed

+74
-58
lines changed

Classes/VirtualObject/Persistence/Query.php

Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
*/
1010
class Query implements QueryInterface
1111
{
12-
/**
13-
* @var \Cundd\Rest\VirtualObject\Persistence\BackendInterface
14-
* @inject
15-
*/
16-
protected $backend;
17-
1812
/**
1913
* @var \Cundd\Rest\VirtualObject\Persistence\PersistenceManager
2014
* @inject
@@ -63,57 +57,85 @@ public function count()
6357
return $this->persistenceManager->getObjectCountByQuery($this);
6458
}
6559

66-
public function setOrderings(array $orderings)
60+
public function getOrderings()
6761
{
68-
$this->orderings = $orderings;
69-
70-
return $this;
62+
return $this->orderings;
7163
}
7264

73-
public function setLimit($limit)
65+
public function getLimit()
7466
{
75-
$this->limit = $limit;
76-
77-
return $this;
67+
return $this->limit;
7868
}
7969

80-
public function setOffset($offset)
70+
public function getOffset()
8171
{
82-
$this->offset = $offset;
83-
84-
return $this;
72+
return $this->offset;
8573
}
8674

87-
public function getOrderings()
75+
public function getConstraint()
8876
{
89-
return $this->orderings;
77+
return $this->constraint;
9078
}
9179

92-
public function getLimit()
80+
public function getSourceIdentifier()
9381
{
94-
return $this->limit;
82+
return $this->sourceIdentifier;
9583
}
9684

97-
public function getOffset()
85+
/**
86+
* Return a copy of the Query with the given constraints
87+
*
88+
* @param array $constraint
89+
* @return QueryInterface
90+
*/
91+
public function withConstraints(array $constraint): QueryInterface
9892
{
99-
return $this->offset;
93+
$clone = clone $this;
94+
$clone->constraint = $constraint;
95+
96+
return $clone;
10097
}
10198

102-
public function getConstraint()
99+
/**
100+
* Return a copy of the Query with the given orderings
101+
*
102+
* @param array $orderings
103+
* @return QueryInterface
104+
*/
105+
public function withOrderings(array $orderings): QueryInterface
103106
{
104-
return $this->constraint;
107+
$clone = clone $this;
108+
$clone->orderings = $orderings;
109+
110+
return $clone;
105111
}
106112

107-
public function setConstraint($constraint)
113+
/**
114+
* Return a copy of the Query with the given limit
115+
*
116+
* @param int $limit
117+
* @return QueryInterface
118+
*/
119+
public function withLimit(int $limit): QueryInterface
108120
{
109-
$this->constraint = $constraint;
121+
$clone = clone $this;
122+
$clone->limit = $limit;
110123

111-
return $this;
124+
return $clone;
112125
}
113126

114-
public function getSourceIdentifier()
127+
/**
128+
* Return a copy of the Query with the given offset
129+
*
130+
* @param int $offset
131+
* @return QueryInterface
132+
*/
133+
public function withOffset(int $offset): QueryInterface
115134
{
116-
return $this->sourceIdentifier;
135+
$clone = clone $this;
136+
$clone->offset = $offset;
137+
138+
return $clone;
117139
}
118140

119141
public function setConfiguration($configuration)

Classes/VirtualObject/Persistence/QueryInterface.php

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -113,48 +113,42 @@ interface QueryInterface
113113
public function execute();
114114

115115
/**
116-
* Sets the property names to order the result by. Expected like this:
117-
* array(
118-
* 'foo' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING,
119-
* 'bar' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
120-
* )
116+
* Return a copy of the Query with the given constraints
121117
*
122-
* @param array $orderings The property names to order by
123-
* @return QueryInterface
124-
* @api
118+
* @param array $constraint
119+
* @return Query
125120
*/
126-
public function setOrderings(array $orderings);
121+
public function withConstraints(array $constraint): self;
127122

128123
/**
129-
* Sets the maximum size of the result set to limit
124+
* Return a copy of the Query with the given property names to order the result by
130125
*
131-
* Returns $this to allow for chaining (fluid interface)
126+
* @example
127+
* [
128+
* 'foo' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING,
129+
* 'bar' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
130+
* ]
132131
*
133-
* @param integer $limit
134-
* @return QueryInterface
135-
* @api
132+
* @param array $orderings
133+
* @return Query
136134
*/
137-
public function setLimit($limit);
135+
public function withOrderings(array $orderings): self;
138136

139137
/**
140-
* Sets the start offset of the result set to offset
141-
*
142-
* Returns $this to allow for chaining (fluid interface).
138+
* Return a copy of the Query with the given limit
143139
*
144-
* @param integer $offset
145-
* @return QueryInterface
146-
* @api
140+
* @param int $limit
141+
* @return Query
147142
*/
148-
public function setOffset($offset);
143+
public function withLimit(int $limit): self;
149144

150145
/**
151-
* Gets the constraint for this query
146+
* Return a copy of the Query with the given offset
152147
*
153-
* @param array $constraint
154-
* @return QueryInterface
155-
* @api
148+
* @param int $offset
149+
* @return Query
156150
*/
157-
public function setConstraint($constraint);
151+
public function withOffset(int $offset): self;
158152

159153
/**
160154
* Returns the query result count

0 commit comments

Comments
 (0)