-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/ungdev/site-etu
- Loading branch information
Showing
27 changed files
with
551 additions
and
162 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
50 changes: 50 additions & 0 deletions
50
src/Etu/Core/CoreBundle/DataFixtures/ORM/LoadCitiesData.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,50 @@ | ||
<?php | ||
|
||
namespace Etu\Core\CoreBundle\DataFixtures\ORM; | ||
|
||
use Doctrine\Common\DataFixtures\AbstractFixture; | ||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface; | ||
use Doctrine\Common\Persistence\ObjectManager; | ||
|
||
use Etu\Core\CoreBundle\Entity\City; | ||
use Etu\Core\CoreBundle\Entity\Page; | ||
|
||
class LoadCitiesData extends AbstractFixture implements OrderedFixtureInterface | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getOrder() | ||
{ | ||
return 2; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function load(ObjectManager $manager) | ||
{ | ||
$troyes = new City(); | ||
$troyes->setName('Troyes') | ||
->setSlug('troyes') | ||
->setPostalCodes('10000') | ||
->setPopulation(60280) | ||
->setLatitude(48.3) | ||
->setLongitude(4.08333); | ||
|
||
$paris = new City(); | ||
$paris->setName('Paris') | ||
->setSlug('paris') | ||
->setPostalCodes('75001|75002|75003|75004|75005|75006|75007|75008|75009|75010|75011|75012|75013|75014|75015|75016|75017|75018|75019|75020|75116') | ||
->setPopulation(2243833) | ||
->setLatitude(48.86) | ||
->setLongitude(2.34445); | ||
|
||
$manager->persist($troyes); | ||
$manager->persist($paris); | ||
$manager->flush(); | ||
|
||
$this->addReference('city_troyes', $troyes); | ||
$this->addReference('city_paris', $paris); | ||
} | ||
} |
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
45 changes: 45 additions & 0 deletions
45
src/Etu/Module/CovoitBundle/DataFixtures/ORM/LoadCovoitData.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,45 @@ | ||
<?php | ||
|
||
namespace Etu\Module\BugsBundle\DataFixtures\ORM; | ||
|
||
use Doctrine\Common\DataFixtures\AbstractFixture; | ||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface; | ||
use Doctrine\Common\Persistence\ObjectManager; | ||
use Etu\Module\CovoitBundle\Entity\Covoit; | ||
use Faker\Factory; | ||
|
||
class LoadCovoitData extends AbstractFixture implements OrderedFixtureInterface | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getOrder() | ||
{ | ||
return 5; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function load(ObjectManager $manager) | ||
{ | ||
$faker = Factory::create('fr_FR'); | ||
|
||
$covoit = new Covoit(); | ||
$covoit->setAuthor($this->getReference('user_user')); | ||
$covoit->setStartCity($this->getReference('city_troyes')); | ||
$covoit->setEndCity($this->getReference('city_paris')); | ||
$covoit->setStartAdress($faker->text(150)); | ||
$covoit->setEndAdress($faker->text(150)); | ||
$covoit->setStartHour('16:00'); | ||
$covoit->setEndHour('19:00'); | ||
$covoit->setCapacity(rand(2, 5)); | ||
$covoit->setDate($faker->dateTimeThisYear); | ||
$covoit->setPhoneNumber($faker->phoneNumber); | ||
$covoit->setPrice(rand(15, 35)); | ||
$covoit->setNotes($faker->text(250)); | ||
|
||
$manager->persist($covoit); | ||
$manager->flush(); | ||
} | ||
} |
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
44 changes: 44 additions & 0 deletions
44
src/Etu/Module/CovoitBundle/Notification/Helper/CanceledHelper.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,44 @@ | ||
<?php | ||
|
||
namespace Etu\Module\CovoitBundle\Notification\Helper; | ||
|
||
use Etu\Core\CoreBundle\Entity\Notification; | ||
use Etu\Core\CoreBundle\Notification\Helper\HelperInterface; | ||
|
||
/** | ||
* Notification for an canceled covoit | ||
*/ | ||
class CanceledHelper implements HelperInterface | ||
{ | ||
/** | ||
* @var \Twig_Environment | ||
*/ | ||
protected $twig; | ||
|
||
/** | ||
* @param \Twig_Environment $twig | ||
*/ | ||
public function __construct(\Twig_Environment $twig) | ||
{ | ||
$this->twig = $twig; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName() | ||
{ | ||
return 'covoit_canceled'; | ||
} | ||
|
||
/** | ||
* @param Notification $notification | ||
* @return string | ||
*/ | ||
public function render(Notification $notification) | ||
{ | ||
return $this->twig->render('EtuModuleCovoitBundle:Notification:canceled.html.twig', array( | ||
'notif' => $notification | ||
)); | ||
} | ||
} |
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.