Salut, je fais mapping entre les entites equipe et matche et autres entity mais je trouve problème entre match et equipe
problème :
code entité Equipe :
<?php
namespace CrudBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* Equipe
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="CrudBundle\Entity\EquipeRepository")
*/
class Equipe
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
* @ORM\Column(name="nom_equipe", type="string", length=255)
*/
private $nomEquipe;
/**
* @var string
*
* @ORM\Column(name="contenu_equipe", type="string", length=255)
*/
private $contenuEquipe;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
public $path;
/**
* @Assert\File(maxSize="6000000")
*/
private $file;
/**
* @ORM\ManyToOne(targetEntity="Matche", inversedBy="equipes")
* @ORM\JoinColumn(name="id_match",referencedColumnName="id")
*/
private $matche;
/**
* @ORM\ManyToOne(targetEntity="Actualite", inversedBy="equipe1")
* @ORM\JoinColumn(name="id_actualite",referencedColumnName="id")
*/
private $actualites;
/**
* @ORM\ManyToOne(targetEntity="Article", inversedBy="equipe")
* @ORM\JoinColumn(name="id_article",referencedColumnName="id")
*/
private $article;
/**
* @ORM\ManyToOne(targetEntity="Palmares", inversedBy="equipe")
* @ORM\JoinColumn(name="id_palmares",referencedColumnName="id")
*/
private $palmares;
/**
* @ORM\ManyToOne(targetEntity="Staffmedical", inversedBy="equipe")
* @ORM\JoinColumn(name="id_staffmedical",referencedColumnName="id")
*/
private $staffmedical;
/**
* @ORM\ManyToOne(targetEntity="Stafftechnique", inversedBy="equipe")
* @ORM\JoinColumn(name="id_stafftechnique",referencedColumnName="id")
*/
private $stafftechnique;
/**
* @ORM\OneToMany(targetEntity="Joueur", mappedBy="equipe")
*/
private $joueurs;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set nomEquipe
*
* @param string $nomEquipe
* @return Equipe
*/
public function setNomEquipe($nomEquipe)
{
$this->nomEquipe = $nomEquipe;
return $this;
}
/**
* Get nomEquipe
*
* @return string
*/
public function getNomEquipe()
{
return $this->nomEquipe;
}
/**
* Set contenuEquipe
*
* @param string $contenuEquipe
* @return Equipe
*/
public function setContenuEquipe($contenuEquipe)
{
$this->contenuEquipe = $contenuEquipe;
return $this;
}
/**
* Get contenuEquipe
*
* @return string
*/
public function getContenuEquipe()
{
return $this->contenuEquipe;
}
/**
* Constructor
*/
public function __construct()
{
$this->matches = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add matches
*
* @param \CrudBundle\Entity\Matche $matches
* @return Equipe
*/
public function addMatch(\CrudBundle\Entity\Matche $matches)
{
$this->matches[] = $matches;
return $this;
}
/**
* Remove matches
*
* @param \CrudBundle\Entity\Matche $matches
*/
public function removeMatch(\CrudBundle\Entity\Matche $matches)
{
$this->matches->removeElement($matches);
}
/**
* Get matches
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getMatches()
{
return $this->matches;
}
/**
* Set actualites
*
* @param \CrudBundle\Entity\Actualite $actualites
* @return Equipe
*/
public function setActualites(\CrudBundle\Entity\Actualite $actualites = null)
{
$this->actualites = $actualites;
return $this;
}
/**
* Get actualites
*
* @return \CrudBundle\Entity\Actualite
*/
public function getActualites()
{
return $this->actualites;
}
/**
* Set article
*
* @param \CrudBundle\Entity\Article $article
* @return Equipe
*/
public function setArticle(\CrudBundle\Entity\Article $article = null)
{
$this->article = $article;
return $this;
}
/**
* Get article
*
* @return \CrudBundle\Entity\Article
*/
public function getArticle()
{
return $this->article;
}
/**
* Set palmares
*
* @param \CrudBundle\Entity\Palmares $palmares
* @return Equipe
*/
public function setPalmares(\CrudBundle\Entity\Palmares $palmares = null)
{
$this->palmares = $palmares;
return $this;
}
/**
* Get palmares
*
* @return \CrudBundle\Entity\Palmares
*/
public function getPalmares()
{
return $this->palmares;
}
/**
* Set staffmedical
*
* @param \CrudBundle\Entity\Staffmedical $staffmedical
* @return Equipe
*/
public function setStaffmedical(\CrudBundle\Entity\Staffmedical $staffmedical = null)
{
$this->staffmedical = $staffmedical;
return $this;
}
/**
* Get staffmedical
*
* @return \CrudBundle\Entity\Staffmedical
*/
public function getStaffmedical()
{
return $this->staffmedical;
}
/**
* Set stafftechnique
*
* @param \CrudBundle\Entity\Stafftechnique $stafftechnique
* @return Equipe
*/
public function setStafftechnique(\CrudBundle\Entity\Stafftechnique $stafftechnique = null)
{
$this->stafftechnique = $stafftechnique;
return $this;
}
/**
* Get stafftechnique
*
* @return \CrudBundle\Entity\Stafftechnique
*/
public function getStafftechnique()
{
return $this->stafftechnique;
}
/**
* Add joueurs
*
* @param \CrudBundle\Entity\Joueur $joueurs
* @return Equipe
*/
public function addJoueur(\CrudBundle\Entity\Joueur $joueurs)
{
$this->joueurs[] = $joueurs;
return $this;
}
/**
* Remove joueurs
*
* @param \CrudBundle\Entity\Joueur $joueurs
*/
public function removeJoueur(\CrudBundle\Entity\Joueur $joueurs)
{
$this->joueurs->removeElement($joueurs);
}
/**
* Get joueurs
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getJoueurs()
{
return $this->joueurs;
}
public function getAbsolutePath()
{
return null === $this->path
? null
: $this->getUploadRootDir().'/'.$this->path;
}
public function getWebPath()
{
return null === $this->path
? null
: $this->getUploadDir().'/'.$this->path;
}
protected function getUploadRootDir()
{
// the absolute directory path where uploaded
// documents should be saved
return __DIR__.'/../../../web/'.$this->getUploadDir();
}
protected function getUploadDir()
{
// get rid of the __DIR__ so it doesn't screw up
// when displaying uploaded doc/image in the view.
return 'uploads/stade';
}
/**
* Sets file.
*
* @param UploadedFile $file
*/
public function setFile(UploadedFile $file = null)
{
$this->file = $file;
}
/**
* Get file.
*
* @return UploadedFile
*/
public function getFile()
{
return $this->file;
}
public function upload()
{
// the file property can be empty if the field is not required
if (null === $this->getFile()) {
return;
}
// use the original file name here but you should
// sanitize it at least to avoid any security issues
// move takes the target directory and then the
// target filename to move to
$this->getFile()->move(
$this->getUploadRootDir(),
$this->getFile()->getClientOriginalName()
);
// set the path property to the filename where you've saved the file
$this->path = $this->getFile()->getClientOriginalName();
// clean up the file property as you won't need it anymore
$this->file = null;
}
/**
* Set path
*
* @param string $path
* @return Stade
*/
public function setPath($path)
{
$this->path = $path;
return $this;
}
/**
* Get path
*
* @return string
*/
public function getPath()
{
return $this->path;
}
/**
* Set matche
*
* @param \CrudBundle\Entity\Matche $matche
* @return Equipe
*/
public function setMatche(\CrudBundle\Entity\Matche $matche = null)
{
$this->matche = $matche;
return $this;
}
/**
* Get matche
*
* @return \CrudBundle\Entity\Matche
*/
public function getMatche()
{
return $this->matche;
}
}
code entité matche:
<?php
namespace CrudBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* Matche
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="CrudBundle\Entity\MatcheRepository")
*/
class Matche
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="resultat_match", type="string", length=255)
*/
private $resultatMatch;
/**
* @var string
*
* @ORM\Column(name="nom_stade", type="string", length=255)
*/
private $nomStade;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
public $path;
/**
* @Assert\File(maxSize="6000000")
*/
private $file;
/**
* @ORM\ManyToOne(targetEntity="Article", inversedBy="matche")
* @ORM\JoinColumn(name="id_article",referencedColumnName="id")
*/
private $articles;
/**
* @ORM\ManyToOne(targetEntity="Actualite", inversedBy="matches")
* @ORM\JoinColumn(name="id_actualite",referencedColumnName="id")
*/
private $actualites;
/**
* @ORM\OneToMany(targetEntity="Stade", mappedBy="matchess")
*/
private $stade;
/**
* @ORM\OneToMany(targetEntity="Equipe", mappedBy="matche")
*/
private $equipes;
/**
* @ORM\OneToMany(targetEntity="Reservation_ticket", mappedBy="matches")
*/
private $matche;
/**
* @ORM\OneToMany(targetEntity="Competition", mappedBy="matchee")
*/
private $competition;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set resultatMatch
*
* @param string $resultatMatch
* @return Matche
*/
public function setResultatMatch($resultatMatch)
{
$this->resultatMatch = $resultatMatch;
return $this;
}
/**
* Get resultatMatch
*
* @return string
*/
public function getResultatMatch()
{
return $this->resultatMatch;
}
/**
* Set nomStade
*
* @param string $nomStade
* @return Matche
*/
public function setNomStade($nomStade)
{
$this->nomStade = $nomStade;
return $this;
}
/**
* Get nomStade
*
* @return string
*/
public function getNomStade()
{
return $this->nomStade;
}
/**
* Set articles
*
* @param \CrudBundle\Entity\Article $articles
* @return Matche
*/
public function setArticles(\CrudBundle\Entity\Article $articles = null)
{
$this->articles = $articles;
return $this;
}
/**
* Get articles
*
* @return \CrudBundle\Entity\Article
*/
public function getArticles()
{
return $this->articles;
}
/**
* Set actualites
*
* @param \CrudBundle\Entity\Actualite $actualites
* @return Matche
*/
public function setActualites(\CrudBundle\Entity\Actualite $actualites = null)
{
$this->actualites = $actualites;
return $this;
}
/**
* Get actualites
*
* @return \CrudBundle\Entity\Actualite
*/
public function getActualites()
{
return $this->actualites;
}
/**
* Set stade
*
* @param \CrudBundle\Entity\Stade $stade
* @return Matche
*/
public function setStade(\CrudBundle\Entity\Stade $stade = null)
{
$this->stade = $stade;
return $this;
}
/**
* Get stade
*
* @return \CrudBundle\Entity\Stade
*/
public function getStade()
{
return $this->stade;
}
/**
* Set equipe
*
* @param \CrudBundle\Entity\Equipe $equipe
* @return Matche
*/
public function setEquipe(\CrudBundle\Entity\Equipe $equipe = null)
{
$this->equipe = $equipe;
return $this;
}
/**
* Get equipe
*
* @return \CrudBundle\Entity\Equipe
*/
public function getEquipe()
{
return $this->equipe;
}
/**
* Constructor
*/
public function __construct()
{
$this->matche = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add matche
*
* @param \CrudBundle\Entity\Reservation_ticket $matche
* @return Matche
*/
public function addMatche(\CrudBundle\Entity\Reservation_ticket $matche)
{
$this->matche[] = $matche;
return $this;
}
/**
* Remove matche
*
* @param \CrudBundle\Entity\Reservation_ticket $matche
*/
public function removeMatche(\CrudBundle\Entity\Reservation_ticket $matche)
{
$this->matche->removeElement($matche);
}
/**
* Get matche
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getMatche()
{
return $this->matche;
}
/**
* Add matches
*
* @param \CrudBundle\Entity\Equipe $matches
* @return Matche
*/
public function addMatch(\CrudBundle\Entity\Equipe $matches)
{
$this->matches[] = $matches;
return $this;
}
/**
* Remove matches
*
* @param \CrudBundle\Entity\Equipe $matches
*/
public function removeMatch(\CrudBundle\Entity\Equipe $matches)
{
$this->matches->removeElement($matches);
}
/**
* Get matches
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getMatches()
{
return $this->matches;
}
/**
* Add competition
*
* @param \CrudBundle\Entity\Competition $competition
* @return Matche
*/
public function addCompetition(\CrudBundle\Entity\Competition $competition)
{
$this->competition[] = $competition;
return $this;
}
/**
* Remove competition
*
* @param \CrudBundle\Entity\Competition $competition
*/
public function removeCompetition(\CrudBundle\Entity\Competition $competition)
{
$this->competition->removeElement($competition);
}
/**
* Get competition
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getCompetition()
{
return $this->competition;
}
/**
* Add stade
*
* @param \CrudBundle\Entity\Stade $stade
* @return Matche
*/
public function addStade(\CrudBundle\Entity\Stade $stade)
{
$this->stade[] = $stade;
return $this;
}
/**
* Remove stade
*
* @param \CrudBundle\Entity\Stade $stade
*/
public function removeStade(\CrudBundle\Entity\Stade $stade)
{
$this->stade->removeElement($stade);
}
public function getAbsolutePath()
{
return null === $this->path
? null
: $this->getUploadRootDir().'/'.$this->path;
}
public function getWebPath()
{
return null === $this->path
? null
: $this->getUploadDir().'/'.$this->path;
}
protected function getUploadRootDir()
{
// the absolute directory path where uploaded
// documents should be saved
return __DIR__.'/../../../web/'.$this->getUploadDir();
}
protected function getUploadDir()
{
// get rid of the __DIR__ so it doesn't screw up
// when displaying uploaded doc/image in the view.
return 'uploads/matche';
}
/**
* Sets file.
*
* @param UploadedFile $file
*/
public function setFile(UploadedFile $file = null)
{
$this->file = $file;
}
/**
* Get file.
*
* @return UploadedFile
*/
public function getFile()
{
return $this->file;
}
public function upload()
{
// the file property can be empty if the field is not required
if (null === $this->getFile()) {
return;
}
// use the original file name here but you should
// sanitize it at least to avoid any security issues
// move takes the target directory and then the
// target filename to move to
$this->getFile()->move(
$this->getUploadRootDir(),
$this->getFile()->getClientOriginalName()
);
// set the path property to the filename where you've saved the file
$this->path = $this->getFile()->getClientOriginalName();
// clean up the file property as you won't need it anymore
$this->file = null;
}
/**
* Set path
*
* @param string $path
* @return Stade
*/
public function setPath($path)
{
$this->path = $path;
return $this;
}
/**
* Get path
*
* @return string
*/
public function getPath()
{
return $this->path;
}
/**
* Add equipes
*
* @param \CrudBundle\Entity\Equipe $equipes
* @return Matche
*/
public function addEquipe(\CrudBundle\Entity\Equipe $equipes)
{
$this->equipes[] = $equipes;
return $this;
}
/**
* Remove equipes
*
* @param \CrudBundle\Entity\Equipe $equipes
*/
public function removeEquipe(\CrudBundle\Entity\Equipe $equipes)
{
$this->equipes->removeElement($equipes);
}
/**
* Get equipes
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getEquipes()
{
return $this->equipes;
}
}
quelle est la solution et merci d'avance
Bonjour,
relis toi, c'est plein de $match, $matche, $matches dans tous les sens. Ce n'est pas compréhensible. Nettoies, réarranges, reformates ton code, renomme tes variables correctement, reformules ton schema, tu trouveras alors très certainement tes erreurs tout seul.