je trouve ce probléme au cours de création schema
[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] The annotation "@Doctrine\ORM\Mapping\PrepPersist" in method ventenligneBundle\Entity\Media::preUpload() does not
exist, or could not be auto-loaded.
code entity Media:
<?php
namespace ventenligneBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\validator\Constraints as Assert;
/**
* Media
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="ventenligneBundle\Entity\MediaRepository")
* @ORM\HasLifecycleCallbacks
*/
class Media
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var \DateTime
*
* @ORM\COlumn(name="updated_at",type="datetime", nullable=true)
*/
private $updateAt;
/**
* @ORM\PostLoad()
*/
public function postLoad()
{
$this->updateAt = new \DateTime();
}
/**
* @ORM\Column(type="string",length=255)
*/
public $name;
/**
* @ORM\Column(type="string",length=255, nullable=true)
*/
public $path;
public $file;
public function getUploadRootDir()
{
return __dir__.'/../../../web/uploads/produit';
}
public function getAbsolutePath()
{
return null === $this->path ? null : $this->getUploadRootDir().'/'.$this->path;
}
public function getAssetPath()
{
return 'uploads/'.$this->path;
}
/**
* @ORM\PrepPersist()
* @ORM\PreUpdate()
*/
public function preUpload()
{
$this->tempFile = $this->getAbsolutePath();
$this->oldFile = $this->getPath();
$this->updateAt = new \DateTime();
if (null !== $this->file)
$this->path = sha1(uniqid(mt_rand(),true)).'.'.$this->file->guessExtension();
}
/**
* @ORM\PostPersist()
* @ORM\PostUpdate()
*/
public function upload()
{
if (null !== $this->file) {
$this->file->move($this->getUploadRootDir(),$this->path);
unset($this->file);
if ($this->oldFile != null) unlink($this->tempFile);
}
}
/**
* @ORM\PreRemove()
*/
public function preRemoveUpload()
{
$this->tempFile = $this->getAbsolutePath();
}
/**
* @ORM\PostRemove()
*/
public function removeUpload()
{
if (file_exists($this->tempFile)) unlink($this->tempFile);
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
public function setPath($path)
{
$this->path = $path;
return $this;
}
/**
* Get path
*
* @return string
*/
public function getPath()
{
return $this->path;
}
/**
* Get name
*
* @return \string
*/
public function getName()
{
return $this->name;
}
/**
* Set updateAt
*
* @param \DateTime $updateAt
* @return Media
*/
public function setUpdateAt($updateAt)
{
$this->updateAt = $updateAt;
return $this;
}
/**
* Get updateAt
*
* @return \DateTime
*/
public function getUpdateAt()
{
return $this->updateAt;
}
/**
* Set name
*
* @param string $name
* @return Media
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
}
quelle est la solution et merci d'avance
Tu as fais une faute de frappe "@ORM\PrepPersist()" au lieu de "@ORM\PrePersist()" ;-)