mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-02-17 15:58:40 +00:00
Implement tests
This commit is contained in:
parent
de783d2204
commit
39578dc27e
|
|
@ -49,35 +49,27 @@ final class ApiController extends Controller
|
||||||
$created = [];
|
$created = [];
|
||||||
|
|
||||||
foreach ($profiles as $profile) {
|
foreach ($profiles as $profile) {
|
||||||
$this->apiProfileCreateDbEntry($profile);
|
$this->apiProfileCreateDbEntry($profile, $request);
|
||||||
|
|
||||||
$created[] = $profile->jsonSerialize();
|
$created[] = $profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
$response->set($request->getUri()->__toString(), [
|
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Profil', 'Profil successfully created.', $created);
|
||||||
'status' => NotificationLevel::OK,
|
|
||||||
'title' => 'Profile(s)',
|
|
||||||
'message' => 'Profile(s) successfully created.',
|
|
||||||
'response' => $created
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Profile $profile Profile to create in the database
|
* @param Profile $profile Profile to create in the database
|
||||||
|
* @param RequestAbstract $request Request
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function apiProfileCreateDbEntry(Profile $profile) : void
|
public function apiProfileCreateDbEntry(Profile $profile, RequestAbstract $request) : void
|
||||||
{
|
{
|
||||||
$this->app->eventManager->trigger('PRE:Module:Admin-profile-create', '', $profile);
|
if ($profile->getId() === 0) {
|
||||||
ProfileMapper::create($profile);
|
$this->createModel($request, $profile, ProfileMapper::class, 'profile');
|
||||||
$this->app->eventManager->trigger('POST:Module:Admin-profile-create', '', [
|
}
|
||||||
$profile->getAccount()->getId(),
|
|
||||||
null,
|
|
||||||
$profile,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user