1. Go to this page and download the library: Download letkode/common-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
throw new EntityNotFoundException('User not found.');
throw new ValueObjectException('Invalid email.', translationKey: 'errors.email_invalid');
#[UniqueField(entityClass: User::class, field: 'email')]
public string $email;
// Update DTO: same email is fine if it's still the record at /users/{uuid}
#[UniqueField(
entityClass: User::class,
field: 'email',
scopes: [new UniqueFieldScope('uuid', UniqueFieldScopeSource::RouteParam, 'uuid', UniqueFieldScopeMode::Exclude)],
)]
public string $email;
// Create DTO: email only needs to be unique within the tenant from /tenants/{tenantUuid}/contacts
#[UniqueField(
entityClass: TenantContact::class,
field: 'email',
scopes: [new UniqueFieldScope('tenant', UniqueFieldScopeSource::RouteParam, 'tenantUuid', scopeEntityClass: Tenant::class)],
)]
public string $email;
#[Route('/users/{uuid}')]
public function show(Uuid $uuid): JsonResponse { ... }
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.