Set spec as default name for sets
This commit is contained in:
parent
e6a4d5d508
commit
a1160c9cbd
|
@ -149,9 +149,9 @@ class CsvImportCommand extends Console
|
|||
}
|
||||
if (isset($columns['setColumn'])) {
|
||||
$sets = $row[$columns['setColumn']];
|
||||
foreach (explode(',', trim($sets)) as $set) {
|
||||
foreach (explode(',', $sets) as $set) {
|
||||
/** @var Set */
|
||||
$setSpec = Database::getInstance()->getEntityManager()->getReference(Set::class, $set);
|
||||
$setSpec = Database::getInstance()->getEntityManager()->getReference(Set::class, trim($set));
|
||||
$record->addSet($setSpec);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,25 +166,25 @@ class Set extends Entity
|
|||
/**
|
||||
* Set the name for this set.
|
||||
*
|
||||
* @param string $name The name
|
||||
* @param ?string $name The name (defaults to spec)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setName(string $name): void
|
||||
public function setName(?string $name): void
|
||||
{
|
||||
$this->name = trim($name);
|
||||
$this->name = $name ?? $this->getSpec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get new entity of set.
|
||||
*
|
||||
* @param string $spec The set spec
|
||||
* @param string $name The name of the set
|
||||
* @param ?string $name The name of the set (defaults to spec)
|
||||
* @param string $description The description of the set
|
||||
*
|
||||
* @throws ValidationFailedException
|
||||
*/
|
||||
public function __construct(string $spec, string $name, string $description = '')
|
||||
public function __construct(string $spec, ?string $name = null, string $description = '')
|
||||
{
|
||||
try {
|
||||
$this->spec = $this->validateRegEx($spec, '/^([A-Za-z0-9\-_\.!~\*\'\(\)])+(:[A-Za-z0-9\-_\.!~\*\'\(\)]+)*$/');
|
||||
|
|
Loading…
Reference in New Issue