private function prepareUploadFileReferences(UploadObjectInterface $object)
    {
        $object->setFileUploadPath($this->fileUploadPath);

        $reflectionClass = new ReflectionClass($object);
        $objectName = $reflectionClass->getShortName();

        $fileUploads = $object->getFileUploads();
        $fileFieldConfigurations = $this->flexModel->getFieldsByDatatype($objectName, 'FILE');
        foreach ($fileFieldConfigurations as $fileFieldConfiguration) {
            $camelizedFieldName = Container::camelize($fileFieldConfiguration['name']);
            $fileFieldProperty = lcfirst($camelizedFieldName);
            if (isset($fileUploads[$fileFieldProperty])) {
                $getter = 'get'.$camelizedFieldName;
                $setter = 'set'.$camelizedFieldName;

                $previousFileReference = $object->$getter();
                if (empty($previousFileReference) === false) {
                    $this->filesScheduledForDeletion[] = sprintf('%s/%s', $this->getFilePath($objectName, $fileFieldConfiguration['name']), $previousFileReference);
                }

                $fileName = md5(uniqid()).'.'.$fileUploads[$fileFieldProperty]->guessExtension();

                $object->$setter($fileName);
            }
        }
    }
private function prepareUploadFileReferences(UploadObjectInterface $object)
    {
        $object->setFileUploadPath($this->fileUploadPath);

        $reflectionClass = new ReflectionClass($object);
        $objectName = $reflectionClass->getShortName();

        $fileUploads = $object->getFileUploads();
        $fileFieldConfigurations = $this->flexModel->getFieldsByDatatype($objectName, 'FILE');
        foreach ($fileFieldConfigurations as $fileFieldConfiguration) {
            $camelizedFieldName = Container::camelize($fileFieldConfiguration['name']);
            $fileFieldProperty = lcfirst($camelizedFieldName);
            if (isset($fileUploads[$fileFieldProperty])) {
                $getter = 'get'.$camelizedFieldName;
                $setter = 'set'.$camelizedFieldName;

                $previousFileReference = $object->$getter();
                if (empty($previousFileReference) === false) {
                    $this->filesScheduledForDeletion[] = sprintf('%s/%s', $this->getFilePath($objectName, $fileFieldConfiguration['name']), $previousFileReference);
                }

                $fileName = md5(uniqid()).'.'.$fileUploads[$fileFieldProperty]->guessExtension();

                $object->$setter($fileName);
            }
        }
    }
private function prepareUploadFileReferences ( UploadObjectInterface $ object ) { $ object -> setFileUploadPath ( $ this -> fileUploadPath ) ; $ reflectionClass = new ReflectionClass ( $ object ) ; $ objectName = $ reflectionClass -> getShortName ( ) ; $ fileUploads = $ object -> getFileUploads ( ) ; $ fileFieldConfigurations = $ this -> flexModel -> getFieldsByDatatype ( $ objectName , 'FILE' ) ; foreach ( $ fileFieldConfigurations as $ fileFieldConfiguration ) { $ camelizedFieldName = Container :: camelize ( $ fileFieldConfiguration [ 'name' ] ) ; $ fileFieldProperty = lcfirst ( $ camelizedFieldName ) ; if ( isset ( $ fileUploads [ $ fileFieldProperty ] ) ) { $ getter = 'get' . $ camelizedFieldName ; $ setter = 'set' . $ camelizedFieldName ; $ previousFileReference = $ object -> $ getter ( ) ; if ( empty ( $ previousFileReference ) === false ) { $ this -> filesScheduledForDeletion [ ] = sprintf ( '%s/%s' , $ this -> getFilePath ( $ objectName , $ fileFieldConfiguration [ 'name' ] ) , $ previousFileReference ) ; } $ fileName = md5 ( uniqid ( ) ) . '.' . $ fileUploads [ $ fileFieldProperty ] -> guessExtension ( ) ; $ object -> $ setter ( $ fileName ) ; } } }
Sets the new file references to the uploaded files on the object and schedules the previous file reference for deletion.

@param UploadObjectInterface $object
Sets the new file references to the uploaded files on the object and schedules the previous file reference for deletion .