Non reconnu champ: nom_utilisateur, tout en interrogeant Par la Doctrine à l'aide de zend framework 2

voici l'extrait de mon code quand j'essaie de l'interroger comme ce

   if ($request->isPost()) {
        $form->setData($request->getPost());
        if ($form->isValid()) {

            //check authentication...
            $this->getAuthService()->getAdapter()
                    ->setIdentity($request->getPost('username'))
                    ->setCredential($request->getPost('password'));

            $username = $request->getPost('username');
            $password = $request->getPost('password');
            $result = $this->getAuthService()->authenticate();

            $criteria = array("user_name" => $username,);
           $results= $this->getEntityManager()->getRepository('Subject\Entity\User')->findBy($criteria);
           print_r($results);
           exit;

j'obtiens l'erreur suivante

Non reconnu champ: nom_utilisateur

Ce sont mes comprend

Use Doctrine\ORM\EntityManager,
Album\Entity\Album;

Edit: c'est mon Sujet\Entity\Utilisateur fichier

 <?php
namespace Subject\Entity;
use Doctrine\ORM\Mapping as ORM;
use Zend\InputFilter\InputFilter;
use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;
/**
* @ORM\Entity
* @ORM\Table(name="users")
* @property string $username
* @property string $password
* @property int $id
*/
class User implements InputFilterAwareInterface {
protected $_username;
protected $_password;
/**
* @ORM\OneToMany(targetEntity="Subject\Entity\Subject", mappedBy="user")
* @var Collection
*/
private $subjects;
/** @ORM\Id() @ORM\Column(type="integer") @ORM\GeneratedValue(strategy="AUTO") @var int */
protected $_id;
public function __get($property) {
return $this->$property;
}
public function __set($property, $value) {
$this->$property = $value;
}
//Getters and setters
/** @return Collection */
public function getSubjects() {
return $this->subjects;
}
/** @param Comment $comment */
public function addSubject(Subject $subjects) {
$this->subjects->add($subjects);
$subjects->setUser($this);
}
public function __construct($subjects) {
//Initializing collection. Doctrine recognizes Collections, not arrays!
$this->subjects = new ArrayCollection();
}
public function getArrayCopy() {
return get_object_vars($this);
}
public function populate($data = array()) {
$this->_id = $data['id'];
$this->_username = $data['username'];
$this->_password = $data['password'];
}
public function setInputFilter(InputFilterInterface $inputFilter) {
throw new \Exception("Not used");
}
public function getInputFilter() {
if (!$this->inputFilter) {
$inputFilter = new InputFilter();
$factory = new InputFactory();
$inputFilter->add($factory->createInput(array(
'name' => 'id',
'required' => true,
'filters' => array(
array('name' => 'Int'),
),
)));
$inputFilter->add($factory->createInput(array(
'name' => 'username',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'StringLength',
'options' => array(
'encoding' => 'UTF-8',
'min' => 1,
'max' => 100,
),
),
),
)));
$inputFilter->add($factory->createInput(array(
'name' => 'password',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'StringLength',
'options' => array(
'encoding' => 'UTF-8',
'min' => 1,
'max' => 100,
),
),
),
)));
$this->inputFilter = $inputFilter;
}
return $this->inputFilter;
}
//put your code here
}
?>
Vous pouvez poster votre Album\Entity\Album classe?
Semble que le champ user_name n'existe pas. Avez-vous utilisé le nom de la propriété de l'interrogation? La base de données nom du champ n'est pas pertinent pour la Doctrine, seul le nom de la propriété.
oui u à la fois de relever correctement, j'ai mis à jour maintenant u peut le comprendre?

OriginalL'auteur noobie-php | 2013-02-05