protected function createLazaret(File $file, Visa $visa, LazaretSession $session, $forced)
    {
        $date = new \DateTime();
        $file->addAttribute(
            new MetadataAttr(
                new Metadata(
                    new TfQuarantine(), new MonoValue($date->format('Y/m/d H:i:s'))
                )
            )
        );

        $lazaretFilesystemService = $this->app['phraseanet.lazaret_filesystem'];
        $persistedLazaret = $lazaretFilesystemService->writeLazaret($file);

        $lazaretFile = new LazaretFile();
        $lazaretFile->setBaseId($file->getCollection()->get_base_id());
        $lazaretFile->setSha256($file->getSha256());
        $lazaretFile->setUuid($file->getUUID());
        $lazaretFile->setOriginalName($file->getOriginalName());

        $lazaretFile->setForced($forced);

        $lazaretFile->setFilename($persistedLazaret->getFilename());
        $lazaretFile->setThumbFileName($persistedLazaret->getThumbnailFilename());

        $lazaretFile->setSession($session);

        $this->app['orm.em']->persist($lazaretFile);

        foreach ($file->getAttributes() as $fileAttribute) {
            $attribute = new LazaretAttribute();
            $attribute->setName($fileAttribute->getName());
            $attribute->setValue($fileAttribute->asString());
            $attribute->setLazaretFile($lazaretFile);
            $lazaretFile->addAttribute($attribute);

            $this->app['orm.em']->persist($attribute);
        }

        foreach ($visa->getResponses() as $response) {
            if ( ! $response->isOk()) {

                $check = new LazaretCheck();
                $check->setCheckClassname(get_class($response->getChecker()));
                $check->setLazaretFile($lazaretFile);

                $lazaretFile->addCheck($check);

                $this->app['orm.em']->persist($check);
            }
        }

        $this->app['orm.em']->flush();

        return $lazaretFile;
    }
protected function createLazaret(File $file, Visa $visa, LazaretSession $session, $forced)
    {
        $date = new \DateTime();
        $file->addAttribute(
            new MetadataAttr(
                new Metadata(
                    new TfQuarantine(), new MonoValue($date->format('Y/m/d H:i:s'))
                )
            )
        );

        $lazaretFilesystemService = $this->app['phraseanet.lazaret_filesystem'];
        $persistedLazaret = $lazaretFilesystemService->writeLazaret($file);

        $lazaretFile = new LazaretFile();
        $lazaretFile->setBaseId($file->getCollection()->get_base_id());
        $lazaretFile->setSha256($file->getSha256());
        $lazaretFile->setUuid($file->getUUID());
        $lazaretFile->setOriginalName($file->getOriginalName());

        $lazaretFile->setForced($forced);

        $lazaretFile->setFilename($persistedLazaret->getFilename());
        $lazaretFile->setThumbFileName($persistedLazaret->getThumbnailFilename());

        $lazaretFile->setSession($session);

        $this->app['orm.em']->persist($lazaretFile);

        foreach ($file->getAttributes() as $fileAttribute) {
            $attribute = new LazaretAttribute();
            $attribute->setName($fileAttribute->getName());
            $attribute->setValue($fileAttribute->asString());
            $attribute->setLazaretFile($lazaretFile);
            $lazaretFile->addAttribute($attribute);

            $this->app['orm.em']->persist($attribute);
        }

        foreach ($visa->getResponses() as $response) {
            if ( ! $response->isOk()) {

                $check = new LazaretCheck();
                $check->setCheckClassname(get_class($response->getChecker()));
                $check->setLazaretFile($lazaretFile);

                $lazaretFile->addCheck($check);

                $this->app['orm.em']->persist($check);
            }
        }

        $this->app['orm.em']->flush();

        return $lazaretFile;
    }
protected function createLazaret ( File $ file , Visa $ visa , LazaretSession $ session , $ forced ) { $ date = new \ DateTime ( ) ; $ file -> addAttribute ( new MetadataAttr ( new Metadata ( new TfQuarantine ( ) , new MonoValue ( $ date -> format ( 'Y/m/d H:i:s' ) ) ) ) ) ; $ lazaretFilesystemService = $ this -> app [ 'phraseanet.lazaret_filesystem' ] ; $ persistedLazaret = $ lazaretFilesystemService -> writeLazaret ( $ file ) ; $ lazaretFile = new LazaretFile ( ) ; $ lazaretFile -> setBaseId ( $ file -> getCollection ( ) -> get_base_id ( ) ) ; $ lazaretFile -> setSha256 ( $ file -> getSha256 ( ) ) ; $ lazaretFile -> setUuid ( $ file -> getUUID ( ) ) ; $ lazaretFile -> setOriginalName ( $ file -> getOriginalName ( ) ) ; $ lazaretFile -> setForced ( $ forced ) ; $ lazaretFile -> setFilename ( $ persistedLazaret -> getFilename ( ) ) ; $ lazaretFile -> setThumbFileName ( $ persistedLazaret -> getThumbnailFilename ( ) ) ; $ lazaretFile -> setSession ( $ session ) ; $ this -> app [ 'orm.em' ] -> persist ( $ lazaretFile ) ; foreach ( $ file -> getAttributes ( ) as $ fileAttribute ) { $ attribute = new LazaretAttribute ( ) ; $ attribute -> setName ( $ fileAttribute -> getName ( ) ) ; $ attribute -> setValue ( $ fileAttribute -> asString ( ) ) ; $ attribute -> setLazaretFile ( $ lazaretFile ) ; $ lazaretFile -> addAttribute ( $ attribute ) ; $ this -> app [ 'orm.em' ] -> persist ( $ attribute ) ; } foreach ( $ visa -> getResponses ( ) as $ response ) { if ( ! $ response -> isOk ( ) ) { $ check = new LazaretCheck ( ) ; $ check -> setCheckClassname ( get_class ( $ response -> getChecker ( ) ) ) ; $ check -> setLazaretFile ( $ lazaretFile ) ; $ lazaretFile -> addCheck ( $ check ) ; $ this -> app [ 'orm.em' ] -> persist ( $ check ) ; } } $ this -> app [ 'orm.em' ] -> flush ( ) ; return $ lazaretFile ; }
Send a package file to lazaret

@param File           $file    The package file
@param Visa           $visa    The visa related to the package file
@param LazaretSession $session The current LazaretSession
@param Boolean        $forced  True if the file has been forced to quarantine

@return LazaretFile
Send a package file to lazaret