option to move entries from one entity to another upon deletion (#409)
This commit is contained in:
@@ -25,6 +25,14 @@ class ActivityFixtures extends Fixture
|
||||
* @var int
|
||||
*/
|
||||
protected $amount = 0;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $isGlobal = false;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $isVisible = null;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
@@ -34,6 +42,28 @@ class ActivityFixtures extends Fixture
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $global
|
||||
* @return $this
|
||||
*/
|
||||
public function setIsGlobal(bool $global)
|
||||
{
|
||||
$this->isGlobal = $global;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $visible
|
||||
* @return $this
|
||||
*/
|
||||
public function setIsVisible(bool $visible)
|
||||
{
|
||||
$this->isVisible = $visible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $amount
|
||||
* @return ActivityFixtures
|
||||
@@ -55,10 +85,17 @@ class ActivityFixtures extends Fixture
|
||||
|
||||
// random amount of timesheet entries for every user
|
||||
for ($i = 0; $i < $this->amount; $i++) {
|
||||
$project = null;
|
||||
if (false === $this->isGlobal) {
|
||||
$project = $projects[array_rand($projects)];
|
||||
}
|
||||
$visible = 0 != $i % 3;
|
||||
if (null !== $this->isVisible) {
|
||||
$visible = $this->isVisible;
|
||||
}
|
||||
$entity = new Activity();
|
||||
$entity
|
||||
->setProject($projects[array_rand($projects)])
|
||||
->setProject($project)
|
||||
->setName($faker->bs . ($visible ? '' : ' (x)'))
|
||||
->setComment($faker->text)
|
||||
->setVisible($visible)
|
||||
|
||||
Reference in New Issue
Block a user