<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rithlock / vich-uploader-serialization-bundle example snippets
use Fresh\VichUploaderSerializationBundle\Annotation as Fresh;
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Fresh\VichUploaderSerializationBundle\Annotation as Fresh;
use JMS\Serializer\Annotation as JMS;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Table(name="users")
* @ORM\Entity()
*
* @Vich\Uploadable
*
* @Fresh\VichSerializableClass
*/
class User
{
/**
* @var string
*
* @ORM\Column(type="string", length=255)
*
* @JMS\Expose
* @JMS\SerializedName("photo")
*
* @Fresh\VichSerializableField("photoFile")
*/
private $photoName;
/**
* @var File
*
* @JMS\Exclude
*
* @Vich\UploadableField(mapping="user_photo_mapping", fileNameProperty="photoName")
*/
private $photoFile;
/**
* @var string
*
* @ORM\Column(type="string", length=255)
*
* @JMS\Expose
* @JMS\SerializedName("cover")
*
* @Fresh\VichSerializableField("coverFile",
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Fresh\VichUploaderSerializationBundle\Annotation as Fresh;
use JMS\Serializer\Annotation as JMS;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Table(name="users")
* @ORM\Entity()
*
* @Vich\Uploadable
*
* @Fresh\VichSerializableClass
*/
class User
{
/**
* @var string
*
* @ORM\Column(type="string", length=255)
*/
private $photoName;
/**
* @var File
*
* !!! Next three annotations should be moved to the `photoName` property
* @JMS\Expose
* @JMS\SerializedName("photo")
* @Fresh\VichSerializableField("photoFile")
*
* !!! This annotation should be left here
* @Vich\UploadableField(mapping="user_photo_mapping", fileNameProperty="photoName")
*/
private $photoFile;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.