Validation and input integration¶
Core 3 deliberately keeps form/input validation outside the ORM persistence contract. AbstractManager::getForm() was removed in 3.0 and small/forms is an optional application dependency.
Small Forms 2.3.0 now uses small/collection 4.x, matching the collection generation used by Core 3, so it can be installed alongside the ORM without the former collection-version conflict.
Small Forms integration¶
Install it explicitly:
Then validate and hydrate before persistence:
use Small\Collection\Collection\StringCollection;
use Small\Forms\Form\FormBuilder;
$user = $userManager->newEntity();
$form = FormBuilder::createFromAttributes($user)
->fillFromArray($requestBody, $user);
$messages = new StringCollection();
$form->validate($messages);
if ($messages->count() !== 0) {
// Return validation errors.
return;
}
$form->hydrate($user);
$user->persist();
Core does not automatically validate an entity during persist(). This is intentional: different application operations may expose different writable fields and validation contracts.
See the complete Small Forms integration guide, including explicit entity type attributes, cross-field validators, modifiers and relation handling.
Other validation layers¶
Small Forms is optional. A framework validator, DTO mapper or custom application service can be used instead. Keep the same boundary: validate/authorize external input before mutating persistent state.
For partial database updates that intentionally bypass entity hydration/lifecycle behavior, use the update builder and validate the update payload in the application layer first.