This repository has been archived by the owner on Dec 26, 2022. It is now read-only.
forked from flef/Incipio
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added a Provider for creating DateTime values from strings * Fixed a nasty bug with the DBAL DateTimeType: the convertion from database value to PHP value was done with the wrong timezone causing sync issues
- Loading branch information
Showing
10 changed files
with
197 additions
and
93 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
ApiBundle\Entity\Mandate: | ||
mandate_2005: | ||
startAt: <dateTimeFromFormat(DateTime::ATOM, '2005-06-25T16:43:30+00:00')> | ||
endAt: <dateTimeFromFormat(DateTime::ATOM, '2006-04-17T09:38:34+00:00')> | ||
jobs: [ @job_president, @job_pr, @job__1 ] | ||
|
||
mandate_2006: | ||
startAt: <startMandateDateTime(2006)> | ||
endAt: <endMandateDateTime($startAt)> | ||
|
||
ApiBundle\Entity\Job: | ||
job (template): | ||
title: <jobTitle()> | ||
abbreviation: <jobAbbreviation()> | ||
enabled: <boolean()> | ||
#user: Should be kept unset since because is set in the user entity | ||
#mandate: Should be kept unset since because is set in the mandate entity | ||
|
||
job_president (extends job): | ||
title: President | ||
abbreviation: PR | ||
enabled: true | ||
|
||
job_pr (extends job): | ||
abbreviation: PR | ||
|
||
job__{1..9} (extends job): {} | ||
|
||
ApiBundle\Entity\User: | ||
user_president: | ||
username: president.tendiserp | ||
fullname: Président TENDISERP | ||
email: [email protected] | ||
roles: [ ROLE_ADMIN ] | ||
plainPassword: guest | ||
enabled: true | ||
jobs: [ @job_president ] | ||
studentConvention: ~ | ||
types: <userTypes('member')> |
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,5 @@ | ||
ApiBundle\Entity\Job: | ||
job_president: | ||
title: President | ||
abbreviation: PR | ||
enabled: true |
36 changes: 36 additions & 0 deletions
36
src/ApiBundle/DataFixtures/Faker/Provider/DateTimeProvider.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,36 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Incipio package. | ||
* | ||
* (c) Théo FIDRY <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace ApiBundle\DataFixtures\Faker\Provider; | ||
|
||
/** | ||
* Extends {@see \Faker\Provider\DateTime}. As all method are static does not literally extend the class to avoid | ||
* useless overhead. | ||
* | ||
* @author Théo FIDRY <[email protected]> | ||
*/ | ||
class DateTimeProvider | ||
{ | ||
/** | ||
* Parses a string into a new DateTime object according to the specified format. | ||
* | ||
* @param string $format Format accepted by date(). | ||
* @param string $time String representing the time. | ||
* | ||
* @return \DateTime | ||
* | ||
* @link http://php.net/manual/en/datetime.createfromformat.php | ||
*/ | ||
public static function dateTimeFromFormat($format, $time) | ||
{ | ||
return \DateTime::createFromFormat($format, $time); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
namespace ApiBundle\DataFixtures\Faker\Provider; | ||
|
||
use Faker\Provider\DateTime as DateTimeProvider; | ||
use Faker\Provider\DateTime as FakerDateTimeProvider; | ||
|
||
/** | ||
* Faker provider for mandates. | ||
|
@@ -20,7 +20,7 @@ | |
* | ||
* @author Théo FIDRY <[email protected]> | ||
*/ | ||
class MandateProvider extends DateTimeProvider | ||
class MandateProvider extends FakerDateTimeProvider | ||
{ | ||
/** | ||
* Generate a datetime starting from the date given and on a period going from 3 month to 2 years. | ||
|
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
Oops, something went wrong.