protected function cloneItemContent(
        core_kernel_classes_Resource $source,
        core_kernel_classes_Resource $destination,
        core_kernel_classes_Property $property
    )
    {

        $serializer = $this->getFileReferenceSerializer();
        $this->setItemModel($destination, $this->getItemModel($source));

        foreach ($source->getUsedLanguages($this->itemContentProperty) as $lang) {
            $sourceItemDirectory = $this->getItemDirectory($source, $lang);
            $destinationItemDirectory = $this->getItemDirectory($destination, $lang);

            foreach ($source->getPropertyValuesCollection($property, array('lg' => $lang))->getIterator() as $propertyValue) {
                $id = $propertyValue instanceof core_kernel_classes_Resource ? $propertyValue->getUri() : (string)$propertyValue;
                $sourceDirectory = $serializer->unserializeDirectory($id);
                $iterator = $sourceDirectory->getFlyIterator(Directory::ITERATOR_FILE | Directory::ITERATOR_RECURSIVE);

                foreach ($iterator as $iteratorFile) {
                    $newFile = $destinationItemDirectory->getFile($sourceItemDirectory->getRelPath($iteratorFile));
                    $newFile->write($iteratorFile->readStream());
                }

                $destinationDirectory = $destinationItemDirectory->getDirectory($sourceItemDirectory->getRelPath($sourceDirectory));
                $serializer->serialize($destinationDirectory);
            }
        }
    }
protected function cloneItemContent(
        core_kernel_classes_Resource $source,
        core_kernel_classes_Resource $destination,
        core_kernel_classes_Property $property
    )
    {

        $serializer = $this->getFileReferenceSerializer();
        $this->setItemModel($destination, $this->getItemModel($source));

        foreach ($source->getUsedLanguages($this->itemContentProperty) as $lang) {
            $sourceItemDirectory = $this->getItemDirectory($source, $lang);
            $destinationItemDirectory = $this->getItemDirectory($destination, $lang);

            foreach ($source->getPropertyValuesCollection($property, array('lg' => $lang))->getIterator() as $propertyValue) {
                $id = $propertyValue instanceof core_kernel_classes_Resource ? $propertyValue->getUri() : (string)$propertyValue;
                $sourceDirectory = $serializer->unserializeDirectory($id);
                $iterator = $sourceDirectory->getFlyIterator(Directory::ITERATOR_FILE | Directory::ITERATOR_RECURSIVE);

                foreach ($iterator as $iteratorFile) {
                    $newFile = $destinationItemDirectory->getFile($sourceItemDirectory->getRelPath($iteratorFile));
                    $newFile->write($iteratorFile->readStream());
                }

                $destinationDirectory = $destinationItemDirectory->getDirectory($sourceItemDirectory->getRelPath($sourceDirectory));
                $serializer->serialize($destinationDirectory);
            }
        }
    }
protected function cloneItemContent ( core_kernel_classes_Resource $ source , core_kernel_classes_Resource $ destination , core_kernel_classes_Property $ property ) { $ serializer = $ this -> getFileReferenceSerializer ( ) ; $ this -> setItemModel ( $ destination , $ this -> getItemModel ( $ source ) ) ; foreach ( $ source -> getUsedLanguages ( $ this -> itemContentProperty ) as $ lang ) { $ sourceItemDirectory = $ this -> getItemDirectory ( $ source , $ lang ) ; $ destinationItemDirectory = $ this -> getItemDirectory ( $ destination , $ lang ) ; foreach ( $ source -> getPropertyValuesCollection ( $ property , array ( 'lg' => $ lang ) ) -> getIterator ( ) as $ propertyValue ) { $ id = $ propertyValue instanceof core_kernel_classes_Resource ? $ propertyValue -> getUri ( ) : ( string ) $ propertyValue ; $ sourceDirectory = $ serializer -> unserializeDirectory ( $ id ) ; $ iterator = $ sourceDirectory -> getFlyIterator ( Directory :: ITERATOR_FILE | Directory :: ITERATOR_RECURSIVE ) ; foreach ( $ iterator as $ iteratorFile ) { $ newFile = $ destinationItemDirectory -> getFile ( $ sourceItemDirectory -> getRelPath ( $ iteratorFile ) ) ; $ newFile -> write ( $ iteratorFile -> readStream ( ) ) ; } $ destinationDirectory = $ destinationItemDirectory -> getDirectory ( $ sourceItemDirectory -> getRelPath ( $ sourceDirectory ) ) ; $ serializer -> serialize ( $ destinationDirectory ) ; } } }
Clone item content

@param core_kernel_classes_Resource $source
@param core_kernel_classes_Resource $destination
@param core_kernel_classes_Property $property
@throws FileNotFoundException
@throws \oat\generis\model\fileReference\FileSerializerException
@throws common_Exception
Clone item content