public static function copy($srcObject, $srcId, $destObject, $destId)
    {
        $i = 0;
        //kopiowanie plików
        foreach (CmsFileQuery::byObject($srcObject, $srcId)->find() as $file) {
            try {
                //tworzenie kopii
                $copy = new \Mmi\Http\RequestFile([
                    'name' => $file->original,
                    'tmp_name' => $file->getRealPath(),
                    'size' => $file->size
                ]);
            } catch (\Mmi\App\KernelException $e) {
                \Mmi\App\FrontController::getInstance()->getLogger()->warning('Unable to copy file, file not found: ' . $file->getRealPath());
                continue;
            }
            $newFile = clone $file;
            $newFile->id = null;
            //dołączanie pliku
            self::_copyFile($copy, $destObject, $destId, $newFile);
            $i++;
        }
        return $i;
    }
public static function copy($srcObject, $srcId, $destObject, $destId)
    {
        $i = 0;
        //kopiowanie plików
        foreach (CmsFileQuery::byObject($srcObject, $srcId)->find() as $file) {
            try {
                //tworzenie kopii
                $copy = new \Mmi\Http\RequestFile([
                    'name' => $file->original,
                    'tmp_name' => $file->getRealPath(),
                    'size' => $file->size
                ]);
            } catch (\Mmi\App\KernelException $e) {
                \Mmi\App\FrontController::getInstance()->getLogger()->warning('Unable to copy file, file not found: ' . $file->getRealPath());
                continue;
            }
            $newFile = clone $file;
            $newFile->id = null;
            //dołączanie pliku
            self::_copyFile($copy, $destObject, $destId, $newFile);
            $i++;
        }
        return $i;
    }
public static function copy ( $ srcObject , $ srcId , $ destObject , $ destId ) { $ i = 0 ; //kopiowanie plików foreach ( CmsFileQuery :: byObject ( $ srcObject , $ srcId ) -> find ( ) as $ file ) { try { //tworzenie kopii $ copy = new \ Mmi \ Http \ RequestFile ( [ 'name' => $ file -> original , 'tmp_name' => $ file -> getRealPath ( ) , 'size' => $ file -> size ] ) ; } catch ( \ Mmi \ App \ KernelException $ e ) { \ Mmi \ App \ FrontController :: getInstance ( ) -> getLogger ( ) -> warning ( 'Unable to copy file, file not found: ' . $ file -> getRealPath ( ) ) ; continue ; } $ newFile = clone $ file ; $ newFile -> id = null ; //dołączanie pliku self :: _copyFile ( $ copy , $ destObject , $ destId , $ newFile ) ; $ i ++ ; } return $ i ; }
Kopiuje plik z jednego obiektu na inny
@param string $srcObject obiekt źródłowy
@param int $srcId id źródła
@param string $destObject obiekt docelowy
@param int $destId docelowy id
@return int ilość skopiowanych
Kopiuje plik z jednego obiektu na inny