refactored search with free search term support (#1064)

This commit is contained in:
Kevin Papst
2019-09-04 18:54:06 +02:00
committed by GitHub
parent 49e1a1c410
commit e99b170d0a
147 changed files with 2071 additions and 1322 deletions

View File

@@ -19,47 +19,53 @@ use Faker\Factory;
/**
* Defines the sample data to load in during controller tests.
*/
class ProjectFixtures extends Fixture
final class ProjectFixtures extends Fixture
{
/**
* @var int
*/
protected $amount = 0;
private $amount = 0;
/**
* @var bool
*/
protected $isVisible = null;
private $isVisible = null;
/**
* @return int
* @var callable
*/
private $callback;
public function getAmount(): int
{
return $this->amount;
}
/**
* @param int $amount
* @return ProjectFixtures
*/
public function setAmount(int $amount)
public function setAmount(int $amount): ProjectFixtures
{
$this->amount = $amount;
return $this;
}
/**
* @param bool $visible
* @return $this
*/
public function setIsVisible(bool $visible)
public function setIsVisible(bool $visible): ProjectFixtures
{
$this->isVisible = $visible;
return $this;
}
/**
* Will be called prior to persisting the object.
*
* @param callable $callback
* @return ProjectFixtures
*/
public function setCallback(callable $callback): ProjectFixtures
{
$this->callback = $callback;
return $this;
}
/**
* {@inheritdoc}
*/
@@ -73,8 +79,8 @@ class ProjectFixtures extends Fixture
if (null !== $this->isVisible) {
$visible = $this->isVisible;
}
$entity = new Project();
$entity
$project = new Project();
$project
->setName($faker->catchPhrase . ($visible ? '' : ' (x)'))
->setBudget(rand(0, 10000))
->setComment($faker->text)
@@ -82,7 +88,10 @@ class ProjectFixtures extends Fixture
->setVisible($visible)
;
$manager->persist($entity);
if (null !== $this->callback) {
call_user_func($this->callback, $project);
}
$manager->persist($project);
}
$manager->flush();