CodeExplorer getOrCreateDefaultFolder example
return MediaDefinition::
class;
} public function generate(int
$numberOfItems, DemodataContext
$context, array
$options =
[]): void
{ $context->
getConsole()->
progressStart($numberOfItems);
$this->faker =
$context->
getFaker();
$writeContext = WriteContext::
createFromContext($context->
getContext());
$mediaFolderId =
$this->
getOrCreateDefaultFolder($context);
$downloadFolderId =
$this->
getOrCreateDefaultFolder($context, true
);
$tags =
$this->
getIds('tag'
);
for ($i = 0;
$i <
$numberOfItems; ++
$i) { $isDownloadFile =
$i % 30 === 0;
$file =
$this->
getRandomFile($context);
$mediaId = Uuid::
randomHex();
$this->writer->
insert( $this->mediaDefinition,
[ [