mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-11-10 14:18:25 +00:00
Remove ContainerAwareInterface and extend Fixture instead
This commit is contained in:
@@ -14,21 +14,17 @@ namespace Chill\MainBundle\DataFixtures\ORM;
|
||||
use Chill\MainBundle\Doctrine\Model\Point;
|
||||
use Chill\MainBundle\Entity\AddressReference;
|
||||
use Chill\MainBundle\Entity\PostalCode;
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Load reference addresses into database.
|
||||
*/
|
||||
class LoadAddressReferences extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
|
||||
class LoadAddressReferences extends Fixture implements OrderedFixtureInterface
|
||||
{
|
||||
protected $faker;
|
||||
|
||||
private ?ContainerInterface $container = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->faker = \Faker\Factory::create('fr_FR');
|
||||
@@ -51,17 +47,10 @@ class LoadAddressReferences extends AbstractFixture implements ContainerAwareInt
|
||||
$manager->flush();
|
||||
}
|
||||
|
||||
public function setContainer(?ContainerInterface $container = null): void
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a random reference address.
|
||||
*
|
||||
* @return AddressReference
|
||||
*/
|
||||
private function getRandomAddressReference(): \Chill\MainBundle\Entity\AddressReference
|
||||
private function getRandomAddressReference(): AddressReference
|
||||
{
|
||||
$ar = new AddressReference();
|
||||
|
||||
@@ -81,10 +70,8 @@ class LoadAddressReferences extends AbstractFixture implements ContainerAwareInt
|
||||
|
||||
/**
|
||||
* Create a random point.
|
||||
*
|
||||
* @return Point
|
||||
*/
|
||||
private function getRandomPoint(): \Chill\MainBundle\Doctrine\Model\Point
|
||||
private function getRandomPoint(): Point
|
||||
{
|
||||
$lonBrussels = 4.35243;
|
||||
$latBrussels = 50.84676;
|
||||
|
||||
Reference in New Issue
Block a user