bundle/Command/SymlinkProjectCommand.php
protected function symlinkProjectFiles(string $projectFilesPath, InputInterface $input, OutputInterface $output): void
    {
        /** @var \DirectoryIterator[] $directories */
        $directories = [];

        $path = $projectFilesPath . '/root_' . $this->environment . '/';
        if ($this->fileSystem->exists($path) && is_dir($path)) {
            $directories[] = new DirectoryIterator($path);
        }

        $path = $projectFilesPath . '/root/';
        if ($this->fileSystem->exists($path) && is_dir($path)) {
            $directories[] = new DirectoryIterator($path);
        }

        foreach ($directories as $directory) {
            foreach ($directory as $item) {
                if ($item->isDot() || $item->isLink()) {
                    continue;
                }

                if ($item->isDir() || $item->isFile()) {
                    if (in_array($item->getBasename(), self::$blacklistedItems, true)) {
                        continue;
                    }

                    $webFolderName = $input->getOption('web-folder');
                    $webFolderName = !empty($webFolderName) ? $webFolderName : 'web';

                    $destination = $this->getContainer()->getParameter('kernel.project_dir') . '/' . $webFolderName . '/' . $item->getBasename();

                    if (!$this->fileSystem->exists(dirname($destination))) {
                        $output->writeln('Skipped creating the symlink for <comment>' . basename($destination) . '</comment> in <comment>' . dirname($destination) . '/</comment>. Folder does not exist!');

                        continue;
                    }

                    if ($item->isDir()) {
                        $this->verifyAndSymlinkDirectory(
                            $item->getPathname(),
                            $destination,
                            $output
                        );
                    } else {
                        $this->verifyAndSymlinkFile(
                            $item->getPathname(),
                            $destination,
                            $output
                        );
                    }
                }
            }
        }
    }
protected function symlinkProjectFiles(string $projectFilesPath, InputInterface $input, OutputInterface $output): void
    {
        /** @var \DirectoryIterator[] $directories */
        $directories = [];

        $path = $projectFilesPath . '/root_' . $this->environment . '/';
        if ($this->fileSystem->exists($path) && is_dir($path)) {
            $directories[] = new DirectoryIterator($path);
        }

        $path = $projectFilesPath . '/root/';
        if ($this->fileSystem->exists($path) && is_dir($path)) {
            $directories[] = new DirectoryIterator($path);
        }

        foreach ($directories as $directory) {
            foreach ($directory as $item) {
                if ($item->isDot() || $item->isLink()) {
                    continue;
                }

                if ($item->isDir() || $item->isFile()) {
                    if (in_array($item->getBasename(), self::$blacklistedItems, true)) {
                        continue;
                    }

                    $webFolderName = $input->getOption('web-folder');
                    $webFolderName = !empty($webFolderName) ? $webFolderName : 'web';

                    $destination = $this->getContainer()->getParameter('kernel.project_dir') . '/' . $webFolderName . '/' . $item->getBasename();

                    if (!$this->fileSystem->exists(dirname($destination))) {
                        $output->writeln('Skipped creating the symlink for <comment>' . basename($destination) . '</comment> in <comment>' . dirname($destination) . '/</comment>. Folder does not exist!');

                        continue;
                    }

                    if ($item->isDir()) {
                        $this->verifyAndSymlinkDirectory(
                            $item->getPathname(),
                            $destination,
                            $output
                        );
                    } else {
                        $this->verifyAndSymlinkFile(
                            $item->getPathname(),
                            $destination,
                            $output
                        );
                    }
                }
            }
        }
    }
protected function symlinkProjectFiles ( string $ projectFilesPath , InputInterface $ input , OutputInterface $ output ) : void { /** @var \DirectoryIterator[] $directories */ $ directories = [ ] ; $ path = $ projectFilesPath . '/root_' . $ this -> environment . '/' ; if ( $ this -> fileSystem -> exists ( $ path ) && is_dir ( $ path ) ) { $ directories [ ] = new DirectoryIterator ( $ path ) ; } $ path = $ projectFilesPath . '/root/' ; if ( $ this -> fileSystem -> exists ( $ path ) && is_dir ( $ path ) ) { $ directories [ ] = new DirectoryIterator ( $ path ) ; } foreach ( $ directories as $ directory ) { foreach ( $ directory as $ item ) { if ( $ item -> isDot ( ) || $ item -> isLink ( ) ) { continue ; } if ( $ item -> isDir ( ) || $ item -> isFile ( ) ) { if ( in_array ( $ item -> getBasename ( ) , self :: $ blacklistedItems , true ) ) { continue ; } $ webFolderName = $ input -> getOption ( 'web-folder' ) ; $ webFolderName = ! empty ( $ webFolderName ) ? $ webFolderName : 'web' ; $ destination = $ this -> getContainer ( ) -> getParameter ( 'kernel.project_dir' ) . '/' . $ webFolderName . '/' . $ item -> getBasename ( ) ; if ( ! $ this -> fileSystem -> exists ( dirname ( $ destination ) ) ) { $ output -> writeln ( 'Skipped creating the symlink for <comment>' . basename ( $ destination ) . '</comment> in <comment>' . dirname ( $ destination ) . '/</comment>. Folder does not exist!' ) ; continue ; } if ( $ item -> isDir ( ) ) { $ this -> verifyAndSymlinkDirectory ( $ item -> getPathname ( ) , $ destination , $ output ) ; } else { $ this -> verifyAndSymlinkFile ( $ item -> getPathname ( ) , $ destination , $ output ) ; } } } } }
Symlinks project files from a bundle.
Symlinks project files from a bundle .