Install/MediaInstaller.php
private function createRootFolders(OutputInterface $output)
    {
        $em = $this->container->get('doctrine.orm.default_entity_manager');
        $repository = $this->container->get('ekyna_media.folder.repository');

        $name = FolderInterface::ROOT;
        $output->write(sprintf(
            '- <comment>%s</comment> %s ',
            ucfirst($name),
            str_pad('.', 44 - mb_strlen($name), '.', STR_PAD_LEFT)
        ));

        if (null !== $folder = $repository->findRoot()) {
            $output->writeln('already exists.');
        } else {
            $folder = new Folder();
            $folder->setName($name);

            $em->persist($folder);
            $em->flush();

            $output->writeln('created.');
        }
    }
private function createRootFolders(OutputInterface $output)
    {
        $em = $this->container->get('doctrine.orm.default_entity_manager');
        $repository = $this->container->get('ekyna_media.folder.repository');

        $name = FolderInterface::ROOT;
        $output->write(sprintf(
            '- <comment>%s</comment> %s ',
            ucfirst($name),
            str_pad('.', 44 - mb_strlen($name), '.', STR_PAD_LEFT)
        ));

        if (null !== $folder = $repository->findRoot()) {
            $output->writeln('already exists.');
        } else {
            $folder = new Folder();
            $folder->setName($name);

            $em->persist($folder);
            $em->flush();

            $output->writeln('created.');
        }
    }
private function createRootFolders ( OutputInterface $ output ) { $ em = $ this -> container -> get ( 'doctrine.orm.default_entity_manager' ) ; $ repository = $ this -> container -> get ( 'ekyna_media.folder.repository' ) ; $ name = FolderInterface :: ROOT ; $ output -> write ( sprintf ( '- <comment>%s</comment> %s ' , ucfirst ( $ name ) , str_pad ( '.' , 44 - mb_strlen ( $ name ) , '.' , STR_PAD_LEFT ) ) ) ; if ( null !== $ folder = $ repository -> findRoot ( ) ) { $ output -> writeln ( 'already exists.' ) ; } else { $ folder = new Folder ( ) ; $ folder -> setName ( $ name ) ; $ em -> persist ( $ folder ) ; $ em -> flush ( ) ; $ output -> writeln ( 'created.' ) ; } }
Creates root folders.

@param OutputInterface $output
Creates root folders .