detail pages for customers and projects (#1371)

This commit is contained in:
Kevin Papst
2020-01-16 16:25:28 +01:00
committed by GitHub
parent 28c5357f11
commit 6a44dbfe83
131 changed files with 3055 additions and 1742 deletions

View File

@@ -12,7 +12,7 @@ namespace App\Tests\DataFixtures;
use App\Entity\Customer;
use App\Entity\Project;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Faker\Factory;
/**
@@ -32,6 +32,10 @@ final class ProjectFixtures extends Fixture
* @var callable
*/
private $callback;
/**
* @var Customer[]
*/
private $customers = [];
public function getAmount(): int
{
@@ -52,6 +56,17 @@ final class ProjectFixtures extends Fixture
return $this;
}
/**
* @param Customer[] $customers
* @return ProjectFixtures
*/
public function setCustomers(array $customers): ProjectFixtures
{
$this->customers = $customers;
return $this;
}
/**
* Will be called prior to persisting the object.
*
@@ -70,7 +85,10 @@ final class ProjectFixtures extends Fixture
*/
public function load(ObjectManager $manager)
{
$customers = $this->getAllCustomers($manager);
$customers = $this->customers;
if (empty($customers)) {
$customers = $this->getAllCustomers($manager);
}
$faker = Factory::create();
for ($i = 0; $i < $this->amount; $i++) {