mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
layout for form
This commit is contained in:
@@ -359,9 +359,10 @@ class ApiController extends AbstractCRUDController
|
||||
* 6. validate the base entity (not the deserialized one). Groups are fetched from getValidationGroups, validation is perform by `validate`
|
||||
* 7. run onAfterValidation
|
||||
* 8. if errors, return a 422 response with errors
|
||||
* 9. flush the data
|
||||
* 10. run onAfterFlush
|
||||
* 11. return a 202 response for DELETE with empty body, or HTTP 200 for post with serialized posted entity
|
||||
* 9. if $forcePersist === true, persist the entity
|
||||
* 10. flush the data
|
||||
* 11. run onAfterFlush
|
||||
* 12. return a 202 response for DELETE with empty body, or HTTP 200 for post with serialized posted entity
|
||||
*
|
||||
* @param string action
|
||||
* @param mixed id
|
||||
@@ -370,11 +371,12 @@ class ApiController extends AbstractCRUDController
|
||||
* @param string $property the name of the property. This will be used to make a `add+$property` and `remove+$property` method
|
||||
* @param string $postedDataType the type of the posted data (the content)
|
||||
* @param string $postedDataContext a context to deserialize posted data (the content)
|
||||
* @param bool $forcePersist force to persist the created element (only for POST request)
|
||||
* @throw BadRequestException if unable to deserialize the posted data
|
||||
* @throw BadRequestException if the method is not POST or DELETE
|
||||
*
|
||||
*/
|
||||
protected function addRemoveSomething(string $action, $id, Request $request, string $_format, string $property, string $postedDataType, $postedDataContext = []): Response
|
||||
protected function addRemoveSomething(string $action, $id, Request $request, string $_format, string $property, string $postedDataType, array $postedDataContext = [], bool $forcePersist = false): Response
|
||||
{
|
||||
$entity = $this->getEntity($action, $id, $request);
|
||||
|
||||
@@ -429,6 +431,10 @@ class ApiController extends AbstractCRUDController
|
||||
return $this->json($errors, 422);
|
||||
}
|
||||
|
||||
if ($forcePersist && $request->getMethod() === Request::METHOD_POST) {
|
||||
$this->getDoctrine()->getManager()->persist($postedData);
|
||||
}
|
||||
|
||||
$this->getDoctrine()->getManager()->flush();
|
||||
|
||||
|
||||
|
@@ -11,9 +11,12 @@
|
||||
*
|
||||
* Do not take time into account
|
||||
*
|
||||
* **Experimental**
|
||||
*/
|
||||
const dateToISO = (date) => {
|
||||
if (null === date) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return [
|
||||
date.getFullYear(),
|
||||
(date.getMonth() + 1).toString().padStart(2, '0'),
|
||||
@@ -36,10 +39,12 @@ const ISOToDate = (str) => {
|
||||
/**
|
||||
* Return a date object from iso string formatted as YYYY-mm-dd:HH:MM:ss+01:00
|
||||
*
|
||||
* **Experimental**
|
||||
*/
|
||||
const ISOToDatetime = (str) => {
|
||||
console.log(str);
|
||||
if (null === str) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let
|
||||
[cal, times] = str.split('T'),
|
||||
[year, month, date] = cal.split('-'),
|
||||
|
Reference in New Issue
Block a user