diff --git a/src/Controller/ProjectController.php b/src/Controller/ProjectController.php index 42053f80c0a810c8d37d8922a17566b7f61e66c4..fb1bd828e385d1e2cb2f603f08202307c342345b 100755 --- a/src/Controller/ProjectController.php +++ b/src/Controller/ProjectController.php @@ -11,6 +11,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Config\Util\Exception\XmlParsingException; use Symfony\Component\Filesystem\Exception\FileNotFoundException; use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Filesystem\Path; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -19,7 +20,7 @@ use ZipArchive; class ProjectController extends AbstractController { - public function __construct(private TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator, private Filesystem $file_system) { } @@ -178,6 +179,17 @@ class ProjectController extends AbstractController */ private function extractZipArchiveInNewCapsuleDirectory(string $capsule_directory): void { + $prototype_directory_root = '../capsule-prototype'; + $this->file_system->mirror( + Path::join($prototype_directory_root), + Path::join($capsule_directory), + null, + ['override' => true, 'delete' => true] + ); + $this->file_system->copy($prototype_directory_root . '/php', $capsule_directory . '/php', true); + $this->file_system->copy($prototype_directory_root . '/file', $capsule_directory . '/file', true); + $this->file_system->copy($prototype_directory_root . '/file', $capsule_directory . '/file', true); + $zip = new ZipArchive(); $zip_file_archive_is_open = $zip->open("create.zip");