PHP Class PartKeepr\UploadedFileBundle\EventListener\TemporaryFileEventListener

显示文件 Open project: partkeepr/PartKeepr

Public Methods

Method Description
__construct ( UploadedFileService $uploadedFileService, ImageService $imageService, Doctrine\Common\Annotations\Reader $reader, Symfony\Component\PropertyAccess\PropertyAccessorInterface $propertyAccessor, Dunglas\ApiBundle\Api\IriConverterInterface $iriConverter )
replaceTemporaryFile ( GetResponseForControllerResultEvent $event ) Replaces any temporary images with actual instances of the configured UploadedFile collection.

Protected Methods

Method Description
getReferenceSetter ( $inverseSideEntity, $owningSideEntity ) : boolean | string Returns the setter name for the inverse side.
replaceFile ( UploadedFile $target, UploadedFile $source )
setReplacementFile ( string $targetEntity, TempUploadedFile | TempImage $source, object $target ) : object Replaces the TemporaryUploadedFile or TempImage with the actual instance. Automatically sets the reference to the owning entity.

Method Details

__construct() public method

public __construct ( UploadedFileService $uploadedFileService, ImageService $imageService, Doctrine\Common\Annotations\Reader $reader, Symfony\Component\PropertyAccess\PropertyAccessorInterface $propertyAccessor, Dunglas\ApiBundle\Api\IriConverterInterface $iriConverter )
$uploadedFileService PartKeepr\UploadedFileBundle\Services\UploadedFileService
$imageService PartKeepr\ImageBundle\Services\ImageService
$reader Doctrine\Common\Annotations\Reader
$propertyAccessor Symfony\Component\PropertyAccess\PropertyAccessorInterface
$iriConverter Dunglas\ApiBundle\Api\IriConverterInterface

getReferenceSetter() protected method

Returns the setter name for the inverse side.
protected getReferenceSetter ( $inverseSideEntity, $owningSideEntity ) : boolean | string
$inverseSideEntity
$owningSideEntity
return boolean | string

replaceFile() protected method

protected replaceFile ( UploadedFile $target, UploadedFile $source )
$target PartKeepr\UploadedFileBundle\Entity\UploadedFile
$source PartKeepr\UploadedFileBundle\Entity\UploadedFile

replaceTemporaryFile() public method

Automatically extracts the proper setters and getters from the metadata and instantiates the correct UploadedFile child class.
public replaceTemporaryFile ( GetResponseForControllerResultEvent $event )
$event Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent The event

setReplacementFile() protected method

Replaces the TemporaryUploadedFile or TempImage with the actual instance. Automatically sets the reference to the owning entity.
protected setReplacementFile ( string $targetEntity, TempUploadedFile | TempImage $source, object $target ) : object
$targetEntity string The entity to create
$source PartKeepr\UploadedFileBundle\Entity\TempUploadedFile | PartKeepr\ImageBundle\Entity\TempImage The source entity
$target object The entity where to set the property
return object The newly created object instance