var dragStart = function (x, y, ev) {
this.data('origTransform', this.transform().local );
};
var dragMove = function(dx, dy, ev, x, y) {
var tdx, tdy;
var snapInvMatrix = this.transform().diffMatrix.invert();
snapInvMatrix.e = snapInvMatrix.f = 0;
tdx = snapInvMatrix.x(dx, dy);
tdy = snapInvMatrix.y(dx, dy);
this.attr({ transform: this.data('origTransform') + (this.data('origTransform') ? "T" : "t") + [ tdx, tdy ] });
};
polygon.drag(dragMove, dragStart);
The form's view data is expected to be an instance of class Symfony\Component\HttpFoundation\File\File, but is a(n) string. You can avoid this error by setting the "data_class" option to null or by adding a view transformer that transforms a(n) string to an instance of Symfony\Component\HttpFoundation\File\File
$builder->add('file', 'file', array(
'label' => false,
'data_class' => null // <-- here
));
Catchable Fatal Error: Argument 1 passed to Proxies\__CG__\AppBundle\Entity\Files::setFile() must be an instance of Symfony\Component\HttpFoundation\File\UploadedFile, null given, called in D:\xampp\htdocs\52realty.local\vendor\symfony\symfony\src\Symfony\Component\PropertyAccess\PropertyAccessor.php on line 410 and defined
Какой смысл тестировать то, что вам не нужно?
объявите поле формы как необязательное с помощью опции required.
Зачем же вы тогда делали поле nullable
нужно описать логику обновления данных сущности из формы
$builder->add('file', 'file', array('label' => false));
2. Не надо перзистить ту сущность, которую получили из формы. Просто получите из неё фотографию и обновите ту сущность, которую получили из БД.
php app\console doctrine:schema:update --force
[Doctrine\DBAL\Exception\DriverException]
An exception occurred while executing 'ALTER TABLE companies CHANGE image i
mage BIGINT NOT NULL':
SQLSTATE[HY000]: General error: 1832 Cannot change column 'image': used in
a foreign key constraint 'FK_8244AA3AC53D045F'
[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[HY000]: General error: 1832 Cannot change column 'image': used in
a foreign key constraint 'FK_8244AA3AC53D045F'
[PDOException]
SQLSTATE[HY000]: General error: 1832 Cannot change column 'image': used in
a foreign key constraint 'FK_8244AA3AC53D045F'
@ORM\JoinColumn(name="image", referencedColumnName="id", nullable=false)
/**
* @var \AppBundle\Entity\File
*
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\File", cascade={"persist"})
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="image", referencedColumnName="id")
* })
*/
private $image;
Catchable Fatal Error: Argument 1 passed to Proxies\__CG__\AppBundle\Entity\File::setFile() must be an instance of Symfony\Component\HttpFoundation\File\UploadedFile, null given, called in