protected function bindUploadFileDescription(
        core_kernel_classes_Property $property,
        tao_helpers_form_data_UploadFileDescription $desc
    ) {
        $instance = $this->getTargetInstance();

        // If form has delete action, remove file
        if ($desc->getAction() == tao_helpers_form_data_UploadFileDescription::FORM_ACTION_DELETE) {
            $this->removeFile($property);
        }

        // If form has add action, remove file & replace by new
        elseif ($desc->getAction() == tao_helpers_form_data_UploadFileDescription::FORM_ACTION_ADD) {
            $name = $desc->getName();
            $size = $desc->getSize();

            if (! empty($name) && ! empty($size)) {

                // Remove old
                $this->removeFile($property);

                // Move the file at the right place.
                $source = $desc->getTmpPath();
                $serial = tao_models_classes_TaoService::singleton()->storeUploadedFile($source, $name);
                $this->getServiceLocator()->get(UploadService::SERVICE_ID)->remove($source);

                // Create association between item & file, database side
                $instance->editPropertyValues($property, $serial);

                // Update the UploadFileDescription with the stored file.
                $desc->setFile($serial);
            }
        }
    }
protected function bindUploadFileDescription(
        core_kernel_classes_Property $property,
        tao_helpers_form_data_UploadFileDescription $desc
    ) {
        $instance = $this->getTargetInstance();

        // If form has delete action, remove file
        if ($desc->getAction() == tao_helpers_form_data_UploadFileDescription::FORM_ACTION_DELETE) {
            $this->removeFile($property);
        }

        // If form has add action, remove file & replace by new
        elseif ($desc->getAction() == tao_helpers_form_data_UploadFileDescription::FORM_ACTION_ADD) {
            $name = $desc->getName();
            $size = $desc->getSize();

            if (! empty($name) && ! empty($size)) {

                // Remove old
                $this->removeFile($property);

                // Move the file at the right place.
                $source = $desc->getTmpPath();
                $serial = tao_models_classes_TaoService::singleton()->storeUploadedFile($source, $name);
                $this->getServiceLocator()->get(UploadService::SERVICE_ID)->remove($source);

                // Create association between item & file, database side
                $instance->editPropertyValues($property, $serial);

                // Update the UploadFileDescription with the stored file.
                $desc->setFile($serial);
            }
        }
    }
protected function bindUploadFileDescription ( core_kernel_classes_Property $ property , tao_helpers_form_data_UploadFileDescription $ desc ) { $ instance = $ this -> getTargetInstance ( ) ; // If form has delete action, remove file if ( $ desc -> getAction ( ) == tao_helpers_form_data_UploadFileDescription :: FORM_ACTION_DELETE ) { $ this -> removeFile ( $ property ) ; } // If form has add action, remove file & replace by new elseif ( $ desc -> getAction ( ) == tao_helpers_form_data_UploadFileDescription :: FORM_ACTION_ADD ) { $ name = $ desc -> getName ( ) ; $ size = $ desc -> getSize ( ) ; if ( ! empty ( $ name ) && ! empty ( $ size ) ) { // Remove old $ this -> removeFile ( $ property ) ; // Move the file at the right place. $ source = $ desc -> getTmpPath ( ) ; $ serial = tao_models_classes_TaoService :: singleton ( ) -> storeUploadedFile ( $ source , $ name ) ; $ this -> getServiceLocator ( ) -> get ( UploadService :: SERVICE_ID ) -> remove ( $ source ) ; // Create association between item & file, database side $ instance -> editPropertyValues ( $ property , $ serial ) ; // Update the UploadFileDescription with the stored file. $ desc -> setFile ( $ serial ) ; } } }
Binds an UploadFileDescription with the target instance.

@access protected
@author Jerome Bogaerts <jerome@taotesting.com>
@param  core_kernel_classes_Property $property The property to bind the data.
@param  tao_helpers_form_data_UploadFileDescription $desc the upload file description.
@return void
@throws \oat\oatbox\service\ServiceNotFoundException
@throws \common_Exception
Binds an UploadFileDescription with the target instance .