[Flow] Image upload and displaying the uploaded image

Cornel Widmer cornel at kollerinternet.ch
Mon Jan 13 15:57:17 CET 2014


I tried NULL a while ago, but with no success because the ORM annotation was missing. Now - with your annotation - it works!

Small correction: the right annotation was @ORM\Column(nullable=true). Without the quotation marks.

Full Code: MODEL
/**
 * @var \TYPO3\Flow\Resource\Resource
 * @ORM\OneToOne
 * @ORM\Column(nullable=true)
 */
protected $image;

/**
 * remover for image
 *
 * @return void
 */
public function removeImage() {
	$this->image = NULL;
}

CONTROLLER:
/**
 * update action
 *
 * @param \Model $model
 * @param \string $deleteImage
 *
 * @return void
 */
public function updateAction(\Model $model, $deleteImage = 'no') {

	if ($deleteImage === 'yes') {
		$this->resourceManager->deleteResource($news->getImage());
		$model->removeImage();
	}

	$this->modelRepository->update($model);

}


More information about the Flow mailing list