Skip to content

Commit

Permalink
closes #51
Browse files Browse the repository at this point in the history
  • Loading branch information
ticktackk committed Mar 10, 2021
1 parent c3808c5 commit 81dcf05
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
## 1.1.0 Release Candidate 1 (`1010051`)

- **New:** Seed for thread prefix (#50)
- **New:** Seed for resource prefix (#51)

## 1.1.0 Alpha 4 (`1010014`)

Expand Down
21 changes: 21 additions & 0 deletions Cli/Command/Seed/SeedResourceManagerItemPrefix.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace TickTackk\Seeder\Cli\Command\Seed;

use Symfony\Component\Console\Input\InputInterface;

/**
* @since 1.1.0 Release Candidate 1
*/
class SeedResourceManagerItemPrefix extends AbstractSeedCommand
{
protected function getSeedName() : string
{
return 'resource-manager-item-prefix';
}

protected function getContentTypePlural(InputInterface $input = null) : string
{
return 'Resource manager item prefixes';
}
}
2 changes: 1 addition & 1 deletion Seed/AbstractContentPrefix.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function getRandomContainerIds() : array
$containerIds = $this->finderWithRandomOrder($this->getContainerIdentifier())->fetch()->keys();
\shuffle($containerIds);

return \array_slice($containerIds, $this->faker()->numberBetween(1, \count($containerIds)));
return \array_slice($containerIds, $this->faker()->numberBetween(0, \count($containerIds)));
}

/**
Expand Down
36 changes: 36 additions & 0 deletions Seed/ResourceManagerItemPrefix.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace TickTackk\Seeder\Seed;

use Faker\Provider\Lorem;
use XF\Entity\AbstractPrefix as AbstractPrefixEntity;
use XF\Mvc\FormAction;
use XF\Repository\ThreadWatch as ThreadWatchRepo;
use XF\Service\Thread\Creator as ThreadCreatorSvc;
use XF\Repository\Thread as ThreadRepo;

/**
* @since 1.1.0 Release Candidate 1
*/
class ResourceManagerItemPrefix extends AbstractContentPrefix
{
protected function getClassIdentifier(): string
{
return 'XFRM:ResourcePrefix';
}

protected function getGroupClassIdentifier(): string
{
return 'XFRM:ResourcePrefixGroup';
}

protected function getMapIdentifier(): string
{
return 'XFRM:CategoryPrefix';
}

protected function getContainerIdentifier(): string
{
return 'XFRM:Category';
}
}

0 comments on commit 81dcf05

Please sign in to comment.