Skip to content

Commit 282a29c

Browse files
committed
Allow REST policy setters to accept arrays
1 parent c4fcdb8 commit 282a29c

72 files changed

Lines changed: 575 additions & 412 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,24 @@ history, the old changelog, and committed file changes. Older Zemit-era entries
1515
are summarized where the commit history is too granular to be useful as
1616
release notes.
1717

18+
## 3.1.0 - Unreleased
19+
20+
### Added
21+
22+
- Added array-friendly REST/query policy setters and merge helpers. Controllers
23+
can now pass plain arrays to field, condition, join, eager-loading, count,
24+
distinct, cache, bind, group, having, column, order, and find policy methods;
25+
PhalconKit normalizes them into internal `Collection` instances.
26+
27+
### Changed
28+
29+
- Updated REST examples, bundled API controllers, migration guidance, and
30+
shipped app-developer skill references to document array-based policy
31+
initialization while preserving `Collection` compatibility.
32+
- Documented that downstream controllers overriding REST/query policy setters
33+
or merge helpers must widen their method signatures to the new
34+
`array|Collection` input contracts.
35+
1836
## 3.0.4 - Unreleased
1937

2038
### Changed

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,40 +82,38 @@ Example resource controller:
8282

8383
namespace App\Modules\Api\Controllers;
8484

85-
use Phalcon\Support\Collection;
86-
8785
final class FooBarController extends AbstractController
8886
{
8987
public function initializeSaveFields(): void
9088
{
91-
$this->setSaveFields(new Collection([
89+
$this->setSaveFields([
9290
'label',
9391
'status',
9492
'usernode' => [
9593
'userId',
9694
'type',
9795
'deleted',
9896
],
99-
]));
97+
]);
10098
}
10199

102100
public function initializeFilterFields(): void
103101
{
104-
$this->setFilterFields(new Collection([
102+
$this->setFilterFields([
105103
'id',
106104
'label',
107105
'status',
108106
'UserNode.userId',
109107
'UserNode.type',
110108
'deleted',
111-
]));
109+
]);
112110
}
113111

114112
public function initializeWith(): void
115113
{
116-
$this->setWith(new Collection([
114+
$this->setWith([
117115
'UserNode.UserEntity',
118-
]));
116+
]);
119117
}
120118
}
121119
```

ROADMAP.md

Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ guidance in the relevant guide or shipped skill reference.
3232

3333
## Current Focus
3434

35-
Target: `3.0.4` release readiness, then `3.1.x` planning
35+
Target: `3.1.0` REST API ergonomics and scaffold readiness
3636

37-
Theme: keep the completed `3.0.4` coverage pass releasable, then start the
38-
next development block with a clear scaffold ownership contract.
37+
Theme: keep REST controller declarations concise and predictable, then continue
38+
the scaffold work with a clear generated-file ownership contract.
3939

4040
Decision:
4141

42-
- The `3.0.4` coverage batch is complete and belongs in the changelog, not in
42+
- Completed `3.0.4` coverage and maintenance work belongs in the changelog, not
4343
active roadmap blocks.
44-
- Do not add broad runtime behavior to `3.0.4`; keep remaining work limited to
45-
QA fixes, release notes, and release mechanics.
46-
- After `3.0.4`, the next development block is REST controller scaffold
47-
readiness. Start with generated-file ownership before adding public
48-
scaffolding behavior.
44+
- REST policy declaration ergonomics start the `3.1.0` development line:
45+
collection-backed setters should accept arrays while storing normalized
46+
collections internally.
47+
- The next schedulable block is REST controller scaffold readiness. Start with
48+
generated-file ownership before adding public scaffolding behavior.
4949

5050
Release principles:
5151

@@ -58,41 +58,11 @@ Release principles:
5858

5959
## Next Blocks
6060

61-
### 3.0.4 Release Readiness
62-
63-
Status: Next
64-
65-
Target: `3.0.4`
66-
67-
Why:
68-
69-
- The testing coverage pass is complete, but the release should not ship with a
70-
failing database-backed unit or stale planning docs.
71-
- The release should preserve the current public behavior and avoid mixing
72-
scaffolding feature work into the patch train.
73-
74-
Scope:
75-
76-
- Keep `composer qa:test`, style, package skeleton, and practical static checks
77-
green for the release environment.
78-
- Keep the changelog focused on shipped behavior and maintainer workflow
79-
changes.
80-
- Remove completed testing-priority inventories from active planning docs.
81-
- Cut and publish the release only after the local release gate is clean.
82-
83-
Validation:
84-
85-
- `composer qa:test`.
86-
- `composer phpcs`.
87-
- `composer skeleton`.
88-
- `composer phpstan`.
89-
- `git diff --check`.
90-
9161
### REST Controller Scaffold Readiness
9262

93-
Status: Planned
63+
Status: Next
9464

95-
Target: `3.1.x`
65+
Target: `3.1.0`
9666

9767
Why:
9868

guides/first-rest-resource.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,61 +114,60 @@ write, filter, search, load, and access.
114114
namespace App\Modules\Api\Controllers;
115115

116116
use App\Models\ProjectUser;
117-
use Phalcon\Support\Collection;
118117

119118
final class ProjectController extends AbstractController
120119
{
121120
public function initializeSaveFields(): void
122121
{
123-
$this->setSaveFields(new Collection([
122+
$this->setSaveFields([
124123
'label',
125124
'status',
126125
'usernode' => [
127126
'userId',
128127
'type',
129128
'deleted',
130129
],
131-
]));
130+
]);
132131
}
133132

134133
public function initializeSearchFields(): void
135134
{
136-
$this->setSearchFields(new Collection([
135+
$this->setSearchFields([
137136
'id',
138137
'label',
139138
'status',
140-
]));
139+
]);
141140
}
142141

143142
public function initializeFilterFields(): void
144143
{
145-
$this->setFilterFields(new Collection([
144+
$this->setFilterFields([
146145
'id',
147146
'label',
148147
'status',
149148
'deleted',
150149
'UserNode.userId',
151150
'UserNode.type',
152-
]));
151+
]);
153152
}
154153

155154
public function initializeWith(): void
156155
{
157-
$this->setWith(new Collection([
156+
$this->setWith([
158157
'UserNode.UserEntity',
159-
]));
158+
]);
160159
}
161160

162161
public function initializeJoins(): void
163162
{
164-
$this->setJoins(new Collection([
163+
$this->setJoins([
165164
'UserNode' => [
166165
ProjectUser::class,
167166
'[' . $this->getModelName() . '].[id] = [UserNode].[projectId]',
168167
'UserNode',
169168
'left',
170169
],
171-
]));
170+
]);
172171
}
173172

174173
public function initializePermissionConditions(): void

0 commit comments

Comments
 (0)