mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Optimized menu
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -13,6 +13,11 @@ use Infinito\Domain\FixtureManagement\EntityTemplateFactory;
|
||||
*/
|
||||
final class GuestUserFixtureSource extends AbstractFixtureSource
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'guest user';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user