Newscoop\Service\Template::copyItem PHP Метод

copyItem() публичный Метод

Copy item
public copyItem ( string $src, string $dest ) : void
$src string
$dest string
Результат void
    public function copyItem($src, $dest)
    {
        try {
            $this->storage->copyItem($src, $dest);
        } catch (\InvalidArgumentException $e) {
            throw new \InvalidArgumentException(sprintf('The template %s could not be created.', "<strong>{$dest}</strong>"), $e->getCode(), $e);
        }
    }

Usage Example

Пример #1
0
 public function copyAction()
 {
     $path = $this->parsePath();
     $file = $this->_getParam('file');
     if (is_array($file)) {
         $file = array_shift($file);
     }
     try {
         $nameExt = pathinfo($this->_getParam('name'), PATHINFO_EXTENSION);
         $name = $this->formatName($this->_getParam('name'), $nameExt == '' ? pathinfo($file, PATHINFO_EXTENSION) : null);
         $this->service->copyItem("{$path}/{$file}", $name);
         $this->_helper->flashMessenger(getGS("Template '\$1' was duplicated into '\$2'.", $file, $name));
     } catch (\InvalidArgumentException $e) {
         $this->_helper->flashMessenger(array('error', $e->getMessage()));
     }
     $this->_redirect(urldecode($this->_getParam('next')), array('prependBase' => false));
 }
All Usage Examples Of Newscoop\Service\Template::copyItem