I´m new on symfony.
I´m getting this error when I try to run
$ php bin/console doctrine:generate:entities LoginBundle:Users
The autoloader expected class "LoginBundle\Entity\Users" to be defined
in file ... The file was found but the class was not in it, the class
name or namespace probably has a typo.
My entity is:
<?
// src/LoginBundle/Entity/Users.php
namespace LoginBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* #ORM\Entity
* #ORM\Table(name="users")
*/
class Users
{
/**
* #ORM\Column(name="id", type="integer")
* #ORM\Id
* #ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* #ORM\Column(name="mail", type="string", length=100)
*/
private $mail;
/**
* #ORM\Column(name="name", type="string", length=30)
*/
private $name;
/**
* #ORM\Column(name="lastname", type="string", length=30)
*/
private $lastname;
/**
* #ORM\Column(name="password", type="string", length=100)
*/
private $password;
public function getMail()
{
return $this->mail;
}
public function getName()
{
return $this->name;
}
public function getLastname()
{
return $this->lastname;
}
public function getPassword()
{
return $this->password;
}
public function setMail($data)
{
$this->mail = $data;
return;
}
public function setName($data)
{
$this->name = $data;
return;
}
public function setLastname($data)
{
$this->lastname = $data;
return;
}
public function setPassword($data)
{
$this->password = $data;
return;
}
}
The php open tag is wrong, because it's a server configuration about short_open_tag
See the Documentation:
try to change
<?
to
<?php
Related
in my symfony project, after adding the topo property to my Media entity related OneToMany to Topo entity I did the migrations,
php bin / console make: migration
It works .But with
php bin/console doctrine:migrations:migrate
I have the errors described on the two images.
In addition to that, the topo view route, topo_show, the following bug:
App \ Entity \ Topo object not found by the #ParamConverter annotation.
My entity file media is :
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\MediaRepository;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation\Uploadable;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\Validator\Constraints as Assert;
/**
* #ORM\Entity(repositoryClass=MediaRepository::class)
* #Vich\Uploadable
*/
class Media
{
/**
* #ORM\Id
* #ORM\GeneratedValue
* #ORM\Column(type="integer")
*/
private $id;
/**
* #ORM\ManyToOne(targetEntity=Site::class, inversedBy="media")
*/
private $site;
/**
* #ORM\Column(type="string", length=255, nullable=true)
*/
private $nom;
/**
* #ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* #ORM\Column(type="string", length=255, nullable=true)
*/
private $image;
/**
* #Vich\UploadableField(mapping="sites", fileNameProperty="image" )
*
*/
private $imageFile;
/**
* #ORM\Column(type="datetime", nullable=true)
*/
private $maj;
/**
* #ORM\ManyToOne(targetEntity=Topo::class, inversedBy="media")
* #ORM\JoinColumn(nullable=false)
*/
private $topo;
public function __toString(){
return $this->nom;
}
public function getId(): ?int
{
return $this->id;
}
public function getSite(): ?Site
{
return $this->site;
}
public function setSite(?Site $site): self
{
$this->site = $site;
return $this;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(?string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
/**
* Get the value of imageFile
*/
public function getImageFile()
{
return $this->imageFile;
}
/**
* Set the value of imageFile
*
* #return self
*/
public function setImageFile($imageFile)
{
$this->imageFile = $imageFile;
return $this;
}
/**
* Get the value of maj
*/
public function getMaj()
{
return $this->maj;
}
/**
* Set the value of maj
*
* #return self
*/
public function setMaj($maj)
{
$this->maj = $maj;
return $this;
}
public function getTopo(): ?Topo
{
return $this->topo;
}
public function setTopo(?Topo $topo): self
{
$this->topo = $topo;
return $this;
}
}
I can't find the solution yet.
And more, I have my API which crashed, which can no longer find the hydramember.
Could you help me? Thank you
so i'm new to Doctrine and PHP in general and i have a small issue that i don't know how to fix...
I need to create a PHP app (using Doctrine) and to make communication with the DB my predecessor used Doctrine ORM; so i tried to use one of his files as a templates to make my part of the app but it does not seem to work...
First, his file used as template:
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* #ORM\Entity(repositoryClass="App\Repository\UserRepository")
* #UniqueEntity("email")
*/
class User implements UserInterface
{
/**
* #ORM\Id()
* #ORM\GeneratedValue()
* #ORM\Column(type="integer")
* #Groups({"campaign_get", "user_logged"})
*/
private $id;
/**
* #ORM\Column(type="string", length=180, unique=true)
* #Assert\NotBlank
* #Assert\Email
* #Groups({"campaign_get", "user_logged"})
*/
private $email;
/**
* #var string The hashed password
* #ORM\Column(type="string")
* #Assert\NotBlank
* #Assert\Regex(
* pattern="/^(?=.{8,}$)(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).*$/",
* message="Votre mot de passe doit contenir au moins 1 chiffre, 1 majuscule, 1 minuscule et avoir une longueur d'au moins 8 caractères."
* )
*/
private $password;
/**
* #ORM\Column(type="string", length=100)
* #Assert\NotBlank
* #Groups("campaign_get")
*/
private $firstname;
/**
* #ORM\Column(type="string", length=100)
* #Assert\NotBlank
* #Groups("campaign_get")
*/
private $lastname;
/**
* #ORM\Column(type="boolean")
*/
private $status;
/**
* #ORM\Column(type="string", length=100, nullable=true)
*/
private $idInstagram;
/**
* #ORM\Column(type="string", length=100, nullable=true)
*/
private $idFacebook;
/**
* #ORM\Column(type="string", length=100, nullable=true)
*/
private $idYoutube;
/**
* #ORM\Column(type="string", length=100, nullable=true)
*/
private $idSnapchat;
/**
* #ORM\Column(type="string", length=100, nullable=true)
*/
private $idTiktok;
/**
* #ORM\Column(type="datetime")
*/
private $createdAt;
/**
* #ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* #ORM\ManyToMany(targetEntity="App\Entity\Role")
* #Groups("campaign_get")
*/
private $userRoles;
/**
* #ORM\ManyToMany(targetEntity="App\Entity\Article", mappedBy="users")
*/
private $articles;
/**
* #ORM\Column(type="string", length=100, nullable=true)
*/
private $companyName;
/**
* #ORM\ManyToMany(targetEntity="App\Entity\Campaign", mappedBy="users")
*/
private $campaigns;
/**
* #ORM\Column(type="string", length=255, nullable=true)
*/
private $resetToken;
public function __construct()
{
$this->userRoles = new ArrayCollection();
$this->articles = new ArrayCollection();
$this->status = 1;
$this->createdAt = new \DateTime();
$this->campaigns = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
/**
* A visual identifier that represents this user.
*
* #see UserInterface
*/
public function getUsername(): string
{
return (string) $this->email;
}
/**
* #see UserInterface
*/
public function getRoles(): array
{
$roles = $this->userRoles;
$userRoles = [];
foreach ($roles as $role) {
$userRoles[] = $role->getName();
}
return $userRoles;
}
/**
* #see UserInterface
*/
public function getPassword(): string
{
return (string) $this->password;
}
public function setPassword(string $password): self
{
$this->password = $password;
return $this;
}
/**
* #see UserInterface
*/
public function getSalt()
{
// not needed when using the "bcrypt" algorithm in security.yaml
}
/**
* #see UserInterface
*/
public function eraseCredentials()
{
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
public function getFirstname(): ?string
{
return $this->firstname;
}
public function setFirstname(string $firstname): self
{
$this->firstname = $firstname;
return $this;
}
public function getLastname(): ?string
{
return $this->lastname;
}
public function setLastname(string $lastname): self
{
$this->lastname = $lastname;
return $this;
}
public function getStatus(): ?bool
{
return $this->status;
}
public function setStatus(bool $status): self
{
$this->status = $status;
return $this;
}
public function getIdInstagram(): ?string
{
return $this->idInstagram;
}
public function setIdInstagram(?string $idInstagram): self
{
$this->idInstagram = $idInstagram;
return $this;
}
public function getIdFacebook(): ?string
{
return $this->idFacebook;
}
public function setIdFacebook(?string $idFacebook): self
{
$this->idFacebook = $idFacebook;
return $this;
}
public function getIdYoutube(): ?string
{
return $this->idYoutube;
}
public function setIdYoutube(?string $idYoutube): self
{
$this->idYoutube = $idYoutube;
return $this;
}
public function getIdSnapchat(): ?string
{
return $this->idSnapchat;
}
public function setIdSnapchat(?string $idSnapchat): self
{
$this->idSnapchat = $idSnapchat;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getIdTiktok(): ?string
{
return $this->idTiktok;
}
public function setIdTiktok(?string $idTiktok): self
{
$this->idTiktok = $idTiktok;
return $this;
}
/**
* #return Collection|Role[]
*/
public function getUserRoles(): Collection
{
return $this->userRoles;
}
public function addUserRole(Role $userRole): self
{
if (!$this->userRoles->contains($userRole)) {
$this->userRoles[] = $userRole;
}
return $this;
}
public function removeUserRole(Role $userRole): self
{
if ($this->userRoles->contains($userRole)) {
$this->userRoles->removeElement($userRole);
}
return $this;
}
/**
* #return Collection|Article[]
*/
public function getArticles(): Collection
{
return $this->articles;
}
public function addArticle(Article $article): self
{
if (!$this->articles->contains($article)) {
$this->articles[] = $article;
$article->addUser($this);
}
return $this;
}
public function removeArticle(Article $article): self
{
if ($this->articles->contains($article)) {
$this->articles->removeElement($article);
$article->removeUser($this);
}
return $this;
}
public function getCompanyName(): ?string
{
return $this->companyName;
}
public function setCompanyName(?string $companyName): self
{
$this->companyName = $companyName;
return $this;
}
/**
* #return Collection|Campaign[]
*/
public function getCampaigns(): Collection
{
return $this->campaigns;
}
public function addCampaign(Campaign $campaign): self
{
if (!$this->campaigns->contains($campaign)) {
$this->campaigns[] = $campaign;
$campaign->addUser($this);
}
return $this;
}
public function removeCampaign(Campaign $campaign): self
{
if ($this->campaigns->contains($campaign)) {
$this->campaigns->removeElement($campaign);
$campaign->removeUser($this);
}
return $this;
}
public function getResetToken(): ?string
{
return $this->resetToken;
}
public function setResetToken(?string $resetToken): self
{
$this->resetToken = $resetToken;
return $this;
}
}
Then, mine using the same philosophy:
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* #ORM\Entity(repositoryClass="App\Repository\AgencyRepository")
*/
class Agency
{
/**
* #ORM\Id()
* #ORM\GeneratedValue()
* #ORM\Column(type="integer")
*/
private $id;
/**
* #ORM\nameAgency()
* #ORM\Column(type"string")
*/
private $nameAgency;
/**
* #ORM\nameContact
* #ORM\Column(type="string")
* #Assert\NotBlank
*/
private $nameContact;
}
Then i try to run this:
php bin/console doctrine:migrations:diff
into a terminal to update the DB, it works fine with the previous file (User Class) but mine (Agency Class) throw a error:
[Semantical Error] The annotation "#Doctrine\ORM\Mapping\nameAgency" in property App\Entity\Agency::$nameAgency was never imported. Did you maybe forget to add
a "use" statement for this annotation?
At first i thought it was an issue with import, so i made exactly the sames imports as in User Class but the error is still present.
Googling the error lead me to a github issue that leeds to this as a fix; but it doesn't seems to work's for me...
What should i do to fix this issue?
You are using
#ORM\nameAgency()
obviously this annotation does not exist, why do you have it there?
Remove #ORM\nameAgency() and #ORM\nameContact, it doesn't make any sense.
Explanation: by #ORM\nameAgency() you actually mean Doctrine\ORM\Mapping\nameAgency and this annotation naturally doesn't exist in Doctrine.
when i try to display all users for admin interface i get this error
Notice: unserialize(): Error at offset 0 of 6 bytes
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
namespace AdminBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
/**
* Description of AdminController
*
* #author saif
*/
class AdminController extends Controller {
public function valide_compteAction()
{
$em=$this->getDoctrine()->getManager();
$utilisateur=$em->getRepository('WelcomeBundle:Utilisateur')->findall();
return $this->render('AdminBundle:admin:valide_compte.html.twig',array('i'=>$utilisateur));
}
}
and this is my userclass
namespace WelcomeBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use \Symfony\Component\Security\Core\User\AdvancedUserInterface;
use JMS\SerializerBundle\Annotation\Type;
/**
* Utilisateur
*
* #ORM\Table(name="utilisateur")
* #ORM\Entity
*/
class Utilisateur extends BaseUser implements AdvancedUserInterface, \Serializable
{
/**
* #var integer
*
* #ORM\Column(name="id", type="integer", nullable=false)
* #ORM\Id
* #ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;
/**
* #var string
*
* #ORM\Column(name="nom", type="string", length=40, nullable=false)
*/
protected $nom;
/**
* #var string
*
* #ORM\Column(name="prenom", type="string", length=40, nullable=false)
*/
protected $prenom;
/**
* #var integer
*
* #ORM\Column(name="numtelphone", type="integer", nullable=true)
*/
protected $numtelphone;
/**
* #var string
*
* #ORM\Column(name="addresse", type="string", length=40, nullable=true)
*/
protected $addresse;
/**
* #var integer
*
* #ORM\Column(name="jeton", type="integer", nullable=true)
*/
protected $jeton;
/**
* #var string
*
* #ORM\Column(name="photo", type="blob", nullable=true)
*/
protected $photo;
/**
* #var string
*
* #ORM\Column(name="mailreclamation", type="string", length=50, nullable=true)
*/
protected $mailreclamation;
public function __construct()
{
parent::__construct();
// your own logic
}
public function getId() {
return $this->id;
}
public function getNom() {
return $this->nom;
}
public function getPrenom() {
return $this->prenom;
}
public function getNumtelphone() {
return $this->numtelphone;
}
public function getAddresse() {
return $this->addresse;
}
public function getJeton() {
return $this->jeton;
}
public function getPhoto() {
return $this->photo;
}
public function getMailreclamation() {
return $this->mailreclamation;
}
public function setId($id) {
$this->id = $id;
}
public function setNom($nom) {
$this->nom = $nom;
}
public function setPrenom($prenom) {
$this->prenom = $prenom;
}
public function setNumtelphone($numtelphone) {
$this->numtelphone = $numtelphone;
}
public function setAddresse($addresse) {
$this->addresse = $addresse;
}
public function setJeton($jeton) {
$this->jeton = $jeton;
}
public function setPhoto($photo) {
$this->photo = $photo;
}
public function setMailreclamation($mailreclamation) {
$this->mailreclamation = $mailreclamation;
}
public function json_encode()
{
return json_encode(array(
$this->password,
$this->salt,
$this->usernameCanonical,
$this->username,
$this->expired,
$this->locked,
$this->credentialsExpired,
$this->enabled,
$this->id,
));
}
}
how can i solve this, i have wasted a lot of time in this
Check the serialized data in the database. Are they consistent? It is possible that the database driver assumes another data type. In this case check the blob type for the photo column. I had had a similar problem with json/array type.
Hy everybody, i've got a problem with my Bundle when I'm trying to obtain the ID of an user.
$user = $userManager->findUserById($tmpID['uid']);
Where $tmpID['uid'] is the ID of the user and when I'm trying to to $user->getId() I obtain an error.
This is the error
FatalErrorException: Error: Call to a member function getId() on a non-object in /Applications/MAMP/htdocs/Api/src/Api/ApiBundle/Controller/DefaultController.php line 263
MyBundle\Entity\User.php
<?php
namespace MyBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Entity\User as BaseUser;
/**
* #ORM\Entity
* #ORM\Table(name="user")
*/
class User extends BaseUser
{
/**
* #ORM\Id
* #ORM\Column(type="integer")
* #ORM\GeneratedValue(strategy="AUTO")
*
*/
protected $id;
/**
* #var string
*
* #ORM\Column(name="description", type="text", nullable=true)
*/
protected $description;
/**
* #var integer
*
* #ORM\Column(name="genre", type="integer", nullable=false)
*/
protected $genre;
/**
* #var string
*
* #ORM\Column(name="device", type="string", nullable=true)
*/
protected $device;
/**
* #var string
*
* #ORM\Column(name="avatar", type="string", nullable=true)
*/
protected $avatar;
/**
* #var string
*
* #ORM\Column(name="phone", type="integer", nullable=true)
*/
protected $phone;
public function __construct()
{
parent::__construct();
// your own logic
}
public function getDescription() {
return $this->description;
}
public function setDescription($description) {
$this->description = $description;
}
public function getGenre() {
return $this->genre;
}
public function setGenre($genre) {
$this->genre = $genre;
}
public function getDevice() {
return $this->device;
}
public function setDevice($device) {
$this->device = $device;
}
public function getPhone() {
return $this->phone;
}
public function setPhone($phone) {
$this->phone = $phone;
}
public function getAvatar() {
return $this->avatar;
}
public function setAvatar($avatar) {
$this->avatar = $avatar;
}
}
While i was going to the office I get the solution! :)
On my function $tmpIDis an variable wich has the token of an user when that used login into Symfony. The problem it was I was using a token of an user wich didn't exist into the DDBB (Yes, i erased the user 5 minutes before to get that error)
Then, i was trying to obtain a non-existent user and that's the reason why i get NULL for $user
I hope my problem can help other people.
p.s. Thanks to #Javad and #George for the suggestions
I haven't found any solid example on how to do this.
I have my entity Shield, which can have more than 1 ShieldTypes. What I want to do is, create a form that creates a new Shield with different Shieldtypes.
This is my code, I honestly don't know where is my error:
Error is:
Entities passed to the choice field must be managed
500 Internal Server Error - FormException
Armory\SearchBundle\Entity\Shield.php
namespace Armory\SearchBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Armory\SearchBundle\Entity\Shield
*
* #ORM\Table(name="shield")
* #ORM\Entity
*/
class Shield
{
/**
* #var integer $id
* #ORM\Column(name="id", type="integer", nullable=false)
* #ORM\Id
* #ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* #var string $name
* #ORM\Column(name="name", type="string", length=45, nullable=false)
*/
private $name;
/**
* #var integer $defense
* #ORM\Column(name="defense", type="integer", nullable=false)
*/
private $defense;
/**
* #var boolean $active
* #ORM\Column(name="active", type="boolean", nullable=false)
*/
private $active;
/**
* #ORM\ManyToMany(targetEntity="ShieldTypes")
* #ORM\JoinTable(name="i_orbs_type",
* joinColumns={#ORM\JoinColumn(name="id_orb", referencedColumnName="id")},
* inverseJoinColumns={#ORM\JoinColumn(name="id_type", referencedColumnName="id")}
* )
* #var ArrayCollection $types
*/
protected $types;
public function __construct(){
$this->types = new \Doctrine\Common\Collections\ArrayCollection();
}
public function getTypes(){
return $this->types;
}
public function getId()
{
return $this->id;
}
public function setName($name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
public function setDefense($defense)
{
$this->defense = $defense;
}
public function getDefense()
{
return $this->defense;
}
public function setActive($active)
{
$this->active = $active;
}
public function getActive()
{
return (bool)$this->active;
}
}
Armory\SearchBundle\Form\ShieldType.php:
namespace Armory\SearchBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
class ShieldType extends AbstractType{
public function buildForm(FormBuilder $builder, array $options){
$builder->add('name','text');
$builder->add('defense','integer');
$builder->add('active','checkbox');
$builder->add('types','entity',
array(
'class'=>'Armory\SearchBundle\Entity\ShieldTypes',
'query_builder'=> function($repository){
return $repository->createQueryBuilder('t')->orderBy('t.id', 'ASC');
},
'property'=>'name', )
);
}
public function getName(){
return 'shield';
}
public function getDefaultOptions(array $options){
return array('data_class'=>'Armory\\SearchBundle\\Entity\\Shield');
}
}
Armory\SearchBundle\Entity\ShieldTypes.php
namespace Armory\SearchBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* SOA\CRMBundle\Entity\ShieldTypes
*
* #ORM\Table(name="orbs_type")
* #ORM\Entity
*/
class ShieldTypes
{
/**
* #var integer $id
*
* #ORM\Column(name="id", type="integer", nullable=false)
* #ORM\Id
* #ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* #var string $name
*
* #ORM\Column(name="name", type="string", length=45, nullable=false)
*/
private $name;
/**
* #var string $title
*
* #ORM\Column(name="title", type="string", length=45, nullable=false)
*/
private $title;
public function getId()
{
return $this->id;
}
public function setName($name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
public function setTitle($title)
{
$this->title = $title;
}
public function getTitle()
{
return $this->title;
}
}
It can be a little confusing but:
Shield entity (database)
ShieldTypes entity (database)
ShieldType form (abstracttype)
Thank you...
So the problem was that I didn't create a repository. I created it (see code at the end) and I still got 'Entities passed to the choice field must be managed' error.
Then I set mutiple to true in:
$builder->add('types','entity',
array(
'class'=>'Armory\SearchBundle\Entity\ShieldTypes',
'query_builder'=> function(\Armory\SearchBundle\Entity\Repository\ShieldTypesRepository $repository){
return $repository->createQueryBuilder('s')->orderBy('s.id', 'ASC');},
'property'=>'title',
'multiple'=>true
)
);
I hope someone finds this useful, cause if I had had this, it would been easier.
Code for my repository:
namespace Armory\SearchBundle\Entity\Repository;
use Doctrine\ORM\EntityRepository;
class ShieldTypesRepository extends EntityRepository
{
public function getAll()
{
return $this->_em->createQuery('SELECT s FROM Armory\SearchBundle\Entity\ShieldTypes s')
->getResult();
}
}