Optimized menu

This commit is contained in:
Kevin Frantz
2019-03-31 17:59:43 +02:00
parent 108debf6bf
commit 1aa5d35169
9 changed files with 129 additions and 17 deletions

View File

@@ -9,6 +9,21 @@ namespace Infinito\Domain\FixtureManagement\FixtureSource;
*/
abstract class AbstractFixtureSource implements FixtureSourceInterface
{
/**
* @var string a human readable name
*/
protected $name = null;
/**
* {@inheritdoc}
*
* @see \Infinito\Domain\FixtureManagement\FixtureSource\FixtureSourceInterface::getName()
*/
public function getName(): string
{
return $this->name ?? self::getSlug();
}
/**
* @return string
*/

View File

@@ -30,4 +30,9 @@ interface FixtureSourceInterface
* @return string|null a fontawesome css class
*/
public static function getIcon(): string;
/**
* @return string A human readable name, if defined, otherwise a slug
*/
public function getName(): string;
}

View File

@@ -13,6 +13,11 @@ use Infinito\Domain\FixtureManagement\EntityTemplateFactory;
*/
final class GuestUserFixtureSource extends AbstractFixtureSource
{
/**
* @var string
*/
protected $name = 'guest user';
/**
* {@inheritdoc}
*

View File

@@ -50,7 +50,8 @@ final class FixtureSourceFactory implements FixtureSourceFactoryInterface
{
$objects = [];
foreach ($classes as $class) {
$objects[] = new $class();
$object = new $class();
$objects[$object->getSlug()] = $object;
}
return $objects;