detail pages for customers and projects (#1371)
This commit is contained in:
@@ -12,7 +12,7 @@ namespace App\Tests\DataFixtures;
|
||||
use App\Entity\Activity;
|
||||
use App\Entity\Project;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Faker\Factory;
|
||||
|
||||
/**
|
||||
@@ -36,6 +36,10 @@ final class ActivityFixtures extends Fixture
|
||||
* @var callable
|
||||
*/
|
||||
private $callback;
|
||||
/**
|
||||
* @var Project[]
|
||||
*/
|
||||
private $projects = [];
|
||||
|
||||
/**
|
||||
* Will be called prior to persisting the object.
|
||||
@@ -79,15 +83,28 @@ final class ActivityFixtures extends Fixture
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Project[] $projects
|
||||
* @return ActivityFixtures
|
||||
*/
|
||||
public function setProjects(array $projects): ActivityFixtures
|
||||
{
|
||||
$this->projects = $projects;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load(ObjectManager $manager)
|
||||
{
|
||||
$projects = $this->getAllProjects($manager);
|
||||
$projects = $this->projects;
|
||||
if (empty($projects)) {
|
||||
$projects = $this->getAllProjects($manager);
|
||||
}
|
||||
$faker = Factory::create();
|
||||
|
||||
// random amount of timesheet entries for every user
|
||||
for ($i = 0; $i < $this->amount; $i++) {
|
||||
$project = null;
|
||||
if (false === $this->isGlobal) {
|
||||
|
||||
Reference in New Issue
Block a user