You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

53 lines
1.1 KiB

  1. <?php
  2. namespace App\DataFixtures;
  3. use App\Entity\Bucket;
  4. use Doctrine\Bundle\FixturesBundle\Fixture;
  5. use Doctrine\Common\Persistence\ObjectManager;
  6. use Symfony\Component\String\Slugger\SluggerInterface;
  7. class AppFixtures extends Fixture
  8. {
  9. /**
  10. * @var SluggerInterface
  11. */
  12. private $slugger;
  13. public function __construct(SluggerInterface $slugger)
  14. {
  15. $this->slugger = $slugger;
  16. }
  17. public function load(ObjectManager $manager)
  18. {
  19. $buckets = [
  20. 'TYPO3 (official)',
  21. 'TYPO3 (related)',
  22. 'Updates',
  23. 'Linux',
  24. 'Work',
  25. 'New',
  26. 'tech',
  27. 'Random',
  28. 'Music',
  29. 'Sport',
  30. 'Games',
  31. 'Coding',
  32. 'Vim',
  33. 'Magazine',
  34. 'Podcasts',
  35. ];
  36. foreach ($buckets as $bucketName) {
  37. $bucket = new Bucket(
  38. $bucketName,
  39. strtolower($this->slugger->slug($bucketName))
  40. );
  41. $manager->persist($bucket);
  42. }
  43. $manager->flush();
  44. }
  45. }