-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0cde35b
commit 6d76125
Showing
5 changed files
with
85 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
use DateTime; | ||
|
||
/** | ||
* Add Order | ||
* Add multiple opening hours at once | ||
* | ||
* @author Pedro Devogelaere <[email protected]> | ||
*/ | ||
|
@@ -53,10 +53,10 @@ public function init() | |
*/ | ||
private function createDaysArray() | ||
{ | ||
$dt = new DateTime(); // create DateTime object with current time | ||
$dt->setISODate($dt->format('o'), $dt->format('W') + 1); // set object to Monday on next week | ||
$periods = new DatePeriod($dt, new DateInterval('P1D'), 3); // get all 1day periods from Monday to +6 days | ||
$days = iterator_to_array($periods); // convert DatePeriod object to array | ||
$dt = new DateTime(); // create DateTime object with current time | ||
$dt->setISODate($dt->format('o'), $dt->format('W') + 1); // set object to Monday on next week | ||
$periods = new DatePeriod($dt, new DateInterval('P1D'), 3); // get all 1day periods from Monday to +6 days | ||
$days = iterator_to_array($periods); // convert DatePeriod object to array | ||
// $days[0] is Monday, ..., $days[3] is Thursday | ||
// to format selected date do: $days[1]->format('Y-m-d'); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
module/ShiftBundle/Form/Admin/RegistrationShift/Schedule.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace ShiftBundle\Form\Admin\RegistrationShift; | ||
|
||
/** | ||
* Add multiple registrations at once; only made to get the hydrator in OpeningHourController | ||
* | ||
* @author Pedro Devogelaere <[email protected]> | ||
*/ | ||
class Schedule extends \CommonBundle\Component\Form\Admin\Form | ||
{ | ||
protected $hydrator = 'ShiftBundle\Hydrator\RegistrationShift'; | ||
} | ||
|