Reset password symfony 4 - symfony-forms

I'm trying to create a reset password for users in symfony 4, I have this error
No route found for "GET /change-password": Method Not Allowed (Allow:
POST)
I'm looking for help please
my Controller:
class ChangepasswordController extends Controller
{
private $oldpassword;
private $newpassword;
/**
* #Route("/change-password", name="change_password", defaults={"email=null"})
* #Method("POST")
* #param Request $request
* #param AuthenticationUtils $authenticationUtils
* #param UserPasswordEncoderInterface $passwordEncoder
* #param $email
* #return Response
*/
public function ChangepasswordAction(Request $request, UserPasswordEncoderInterface $passwordEncoder, $email)
{
$user = new User();
$form = $this->createForm(ChangepasswordType::class, $user);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
try {
$user = $this->getDoctrine()->getRepository(User::class)->find($email);
} catch (ExceptionInterface $e) {
$this->addFlash('danger', "Cet email n'existe pas.");
}
//Recuperer le nouveau mot de passe tapé par l'utilisateur
$newpassword = $passwordEncoder->encodePassword($user, $user->getPassword());
//recuperer l'ancien mot de passe dans la base de donnéees
$oldpassword = $user->getPassword();
if ($newpassword = $oldpassword) {
$this->addFlash('danger', "Ce mot de passe est dejà utilisé.");
} else {
$user->setPassword($newpassword);
}
$em = $this->getDoctrine()->getManager();
$em->persist($user);
$em->flush();
$this->addFlash('success', 'votre mot de passe est bien réinitialisé');
# Redirection sur la page de connexion
return $this->redirectToRoute('connexion');
}
return $this->render(
'security/changemotdepasse.html.twig',
array('form' => $form->createView())
);
}
}

You have to change #Method("POST") to #Method({"GET","POST"}), because your Action is for displaying and processing the form.

I think GET method is not good way to reset password, you can add GET in Methode annotation to fix it but it’s bad way .
The good way is just send data by POST Method and handle it in $request

#Route("/change-password", name="change_password"
Take care of your definition ... - !== _

Related

webapi with basic authorize

I've created a WebApi with .NET.
I want to secure some methods.
I would like only the users in aspnetuser table can execute this methods
I've created as
public class BasicAuthHttpModule : IHttpModule
and in the web.config I configured this as
<system.webServer>
<modules>
<add name="BasicAuthHttpModule" type="WebHostBasicAuth.Modules.BasicAuthHttpModule"/>
</modules>
</system.webServer>
And my BasicAuthHttpModule.cs:
I check the email and password with the aspnetusers tabla
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Security.Principal;
using System.Text;
using System.Threading;
using System.Web;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin;
using ServicioProx360.Models;
using ServicioProx360;
namespace WebHostBasicAuth.Modules
{
public class BasicAuthHttpModule: IHttpModule
{
private const string Realm = "WebAPI Authentication";
public void Init(HttpApplication context)
{
// Se registran los manejadores de los eventos
context.AuthenticateRequest += OnApplicationAuthenticateRequest;
context.EndRequest += OnApplicationEndRequest;
}
private static void SetPrincipal(IPrincipal principal)
{
Thread.CurrentPrincipal = principal;
if (HttpContext.Current != null)
{
HttpContext.Current.User = principal;
}
}
private static bool AuthenticateUser(string credentials)
{
var encoding = Encoding.GetEncoding("iso-8859-1");
credentials = encoding.GetString(Convert.FromBase64String(credentials));
var credentialsArray = credentials.Split(':');
var username = credentialsArray[0];
var password = credentialsArray[1];
var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
ApplicationUser usuario = manager.Find(username, password);
/* Aquí se validan las credenciales o el token enviado en el encabezado de la solicitud */
// if (!(username == "test" && password == "test"))
if (usuario==null)
{
return false;
}
var identity = new GenericIdentity(usuario.UserName);
SetPrincipal(new GenericPrincipal(identity, new string[] { "CIUDADADNO" }));
return true;
}
private static void OnApplicationAuthenticateRequest(object sender, EventArgs e)
{
var request = HttpContext.Current.Request;
var authHeader = request.Headers["Authorization"];
if (authHeader != null)
{
var authHeaderVal = AuthenticationHeaderValue.Parse(authHeader);
// Se valida si el esquema de autenticación es básico (Basic Authentication)
if (authHeaderVal.Scheme.Equals("basic", StringComparison.OrdinalIgnoreCase) && authHeaderVal.Parameter != null)
{
AuthenticateUser(authHeaderVal.Parameter);
}
}
}
// Si la solicitud no fue aprobada, se agrega el encabezado WWW-Authenticate a la respuesta
private static void OnApplicationEndRequest(object sender, EventArgs e)
{
var response = HttpContext.Current.Response;
if (response.StatusCode == 401)
{
response.Headers.Add("WWW-Authenticate", string.Format("Basic realm=\"{0}\"", Realm));
}
}
public void Dispose()
{
}
}
}
but it doen't work fine. if method is [authorize], it ask me for the email and password,I put correct data, but it ask again, again,again.
Can you help me?
Thank you very much
Take a look at this tutorial, it explains pretty well.
https://learn.microsoft.com/en-us/aspnet/web-api/overview/security/basic-authentication

ASPNET MVC 4: User.IsInRole() always returns false

I can not get User.IsInRole() work.
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginModel model, string returnUrl)
{
if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
{
string roleUser;
if (User.IsInRole("Administrateurs"))
{
roleUser = "Administrateurs";
}
else if (User.IsInRole("Conseillers"))
{
roleUser = "Conseillers";
}
else if (User.IsInRole("Demandeurs"))
{
roleUser = "Demandeurs";
}
else
{
roleUser = "Erreur!";
}
return (null);
}
My webconfig, looks fine.
I customized the original AccountController as per below and all seems ok when when registering or creating users and assigning roles:
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Register(RegisterModel model)
{
if (ModelState.IsValid)
{
bool erreur = false;
// Attempt to register the user
try
{
//************* Création du nouveau compte ********************
WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
//WebSecurity.Login(model.UserName, model.Password);
}
catch (MembershipCreateUserException e)
{
erreur = true;
ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
}
finally
{
//************* S'assurer que l'utilisateur a été créé *****************
if (erreur == false)
{
try
{
//***************** Association du nouveau compte d'utilisateur avec le rôle *************
RoleAddToUser(model.NomRole, model.UserName);
//***************** Association du nouveau compte d'utilisateur avec le demandeur / conseiller *************
var i = db.spGetUsrID(model.UserName).ToArray();
Conseillers_Demandeurs_Utilisateurs lienUtilDdeur_Cons = new Conseillers_Demandeurs_Utilisateurs()
{
UserId = (int)i[0],
Code_Demandeur_Conseiller = model.NomPersonne,
Actif_Inactif = true,
Dte_Saisie = DateTime.Now,
UserId1 = 1 //******************* UserId = loanDdeur.UserId;
};
db.Conseillers_Demandeurs_Utilisateurs.Add(lienUtilDdeur_Cons);
db.SaveChanges();
}
catch (Exception e)
{
throw e;
}
}
}
return RedirectToAction("Account", "Register");
}
// If we got this far, something failed, redisplay form
return View(model);
}
and
/// <summary>
/// Add role to the user
/// </summary>
/// <param name="RoleName"></param>
/// <param name="UserName"></param>
/// <returns></returns>
[Authorize(Roles = "Administrateurs")]
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult RoleAddToUser(string RoleName, string UserName)
{
string mag;
if (Roles.IsUserInRole(UserName, RoleName))
{
//ViewBag.ResultMessage = "This user already has the role specified !";
mag = "This user already has the role specified !";
}
else
{
Roles.AddUserToRole(UserName, RoleName);
//ViewBag.ResultMessage = "Username added to the role succesfully !";
mag = "Username added to the role succesfully !";
}
//SelectList list = new SelectList(Roles.GetAllRoles());
//ViewBag.Roles = list;
return Json(mag, JsonRequestBehavior.AllowGet);
//return View();
}
I can see the result in my SQL tables
With some search, I end up using:
Roles.GetRolesForUser(model.UserName)
or
Roles.IsUserInRole(model.UserName, "Administrateurs")
These work but I also read User.IsInRole() was the correct and only way recommended by Microsoft.
Does anyone get an idea?
You are using SimpleMembershipProvider, not Asp.Net Identity framework. User.IsInRole() works well with Identity, but I'm not sure if it will work with SimpleMembershipProvider.
I'm afraid you'll have to stick with the method that work for you: Roles.IsUserInRole. Unless you fancy updating to Identity framework (and that involves some effort).

MySql query string to sql object

Using Zend Framework 2 is possible to get a sql string from a tablegateway object, like this:
public function test(){
$sql = $this->tableGateway->getSql();
$select = $sql->select();
$select->where(array('title' => 'abracadabra'));
$select->where
->NEST->
equalTo('id', 1)
->OR->
equalTo('artist', 'Tony')
->UNNEST;
$select->limit(1);
return $this->tableGateway->selectWith($select);
}
//code ignored here//
echo $sql->getSqlstringForSqlObject($select);
I was wondering if it could be possible to do the opposite, and basically set a query string and then get back a tableGateway object, the reason for this is that sometimes is needed to set a where clause dynamically, without having to know where to place/append it, example:
On a single query:
$sql = "select * from tbl_test";
if($isDynamic)
$sql .= ' where test_id=1';
But on more complex query:
$sql = "select * from tbl_test inner join (select * from tbl_test 1) x on 1=1 where test_id is not null group by test_id";
//OF COURSE IT WILL FAIL.
if($isDynamic)
$sql .= ' where test_id=1';
Using zf2 I could potentially do something like
Setting the query string to a sql object.
Then simply do $obj->where(array('test_id'=>1));
To solve this problem I overloaded method Zend\Db\Sql\Select.
For your example of a complex query, I proceed as follows:
Your query : select * from tbl_test inner join (select * from tbl_test 1) x on 1=1 where test_id is not null group by test_id
My query : SELECT * FROM (select * from tbl_test inner join (select * from tbl_test 1) x on 1=1 where test_id is not null group by test_id) tmp WHERE test_id=1;
If your complex query use alias tmp then change in the method renderTable().
Here is how my class is used (change the namespace as need):
use SbmPdf\Model\Db\Sql\Select;
$sql = "select * from tbl_test inner join (select * from tbl_test 1) x on 1=1 where test_id is not null group by test_id";
$select = new Select($sql);
$select->where(array('id' => 1));
Here is my class (change the namespace as need):
/**
* Surcharge de la classe Zend\Db\Sql\Select pour exécuter une requête complexe basée sur une chaine SQL
*
* On a ajouté la méthode setRecordSource qui permet de passer une chaine SQL complète comme source de donnée.
*
* Lorsque la chaine SQL recordSource est donnée (constructeur ou setter), elle remplace la table indiquée dans FROM.
* En définitive, la méthode from() sera ignorée si la méthode recordSource() est appelée.
* Par contre, si on n'appelle pas cette nouvelle méthode, la classe aura un comportement normal (à condition de ne
* rien passer au constructeur).
*
* Ensuite, pour exécuter la requête, il faut pratiquer de la façon suivante :
* $sqlString = $select->getSqlString($dbAdapter->getPlatform());
* $rowset = $dbAdapter->query($sqlString, \Zend\Db\Adapter\Adapter::QUERY_MODE_EXECUTE);
*
* #project sbm
* #package SbmPdf/Model/Db/Sql
* #filesource Select.php
* #encodage UTF-8
* #author DAFAP Informatique - Alain Pomirol (dafap#free.fr)
* #date 19 août 2015
* #version 2015-1
*/
namespace SbmPdf\Model\Db\Sql;
use Zend\Db\Adapter\Driver\DriverInterface;
use Zend\Db\Adapter\ParameterContainer;
use Zend\Db\Adapter\Platform\PlatformInterface;
use Zend\Db\Sql\Select as ZendSelect;
class Select extends ZendSelect
{
private $recordSource;
/**
* On passe le recordSource (sql string) par le constructeur. On ne peut plus passer la table.
*
* #param string $recordSource
*/
public function __construct($recordSource = null)
{
parent::__construct();
$this->recordSource = $recordSource;
}
/**
* On peut aussi le passer par le setter
*
* #param string $recordSource
* #return \SbmPdf\Model\Db\Sql\Select
*/
public function setRecordSource($recordSource)
{
$this->recordSource = $recordSource;
return $this;
}
/**
* Surcharge de la méthode
*
* (non-PHPdoc)
*
* #see \Zend\Db\Sql\Select::processSelect()
*/
protected function processSelect(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
{
$expr = 1;
if (empty($this->recordSource)) {
list ($table, $fromTable) = parent::resolveTable($this->table, $platform, $driver, $parameterContainer);
} else {
list ($table, $fromTable) = $this->resolveTable($this->recordSource, $platform);
}
// process table columns
$columns = array();
foreach ($this->columns as $columnIndexOrAs => $column) {
if ($column === self::SQL_STAR) {
$columns[] = array(
$fromTable . self::SQL_STAR
);
continue;
}
$columnName = $this->resolveColumnValue(array(
'column' => $column,
'fromTable' => $fromTable,
'isIdentifier' => true
), $platform, $driver, $parameterContainer, (is_string($columnIndexOrAs) ? $columnIndexOrAs : 'column'));
// process As portion
if (is_string($columnIndexOrAs)) {
$columnAs = $platform->quoteIdentifier($columnIndexOrAs);
} elseif (stripos($columnName, ' as ') === false) {
$columnAs = (is_string($column)) ? $platform->quoteIdentifier($column) : 'Expression' . $expr ++;
}
$columns[] = (isset($columnAs)) ? array(
$columnName,
$columnAs
) : array(
$columnName
);
}
// process join columns
foreach ($this->joins as $join) {
$joinName = (is_array($join['name'])) ? key($join['name']) : $join['name'];
$joinName = parent::resolveTable($joinName, $platform, $driver, $parameterContainer);
foreach ($join['columns'] as $jKey => $jColumn) {
$jColumns = array();
$jFromTable = is_scalar($jColumn) ? $joinName . $platform->getIdentifierSeparator() : '';
$jColumns[] = $this->resolveColumnValue(array(
'column' => $jColumn,
'fromTable' => $jFromTable,
'isIdentifier' => true
), $platform, $driver, $parameterContainer, (is_string($jKey) ? $jKey : 'column'));
if (is_string($jKey)) {
$jColumns[] = $platform->quoteIdentifier($jKey);
} elseif ($jColumn !== self::SQL_STAR) {
$jColumns[] = $platform->quoteIdentifier($jColumn);
}
$columns[] = $jColumns;
}
}
if ($this->quantifier) {
$quantifier = ($this->quantifier instanceof ExpressionInterface) ? $this->processExpression($this->quantifier, $platform, $driver, $parameterContainer, 'quantifier') : $this->quantifier;
}
if (! isset($table)) {
return array(
$columns
);
} elseif (isset($quantifier)) {
return array(
$quantifier,
$columns,
$table
);
} else {
return array(
$columns,
$table
);
}
}
protected function resolveTable($table, PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
{
$alias = null;
if (is_array($table)) {
$alias = key($table);
$table = current($table);
} else {
$alias = 'tmp';
}
$fromTable = $platform->quoteIdentifier($alias);
$table = $this->renderTable($table, $fromTable, false);
if ($alias) {} else {
$fromTable = $table;
}
if ($this->prefixColumnsWithTable && $fromTable) {
$fromTable .= $platform->getIdentifierSeparator();
} else {
$fromTable = '';
}
return array(
$table,
$fromTable
);
}
protected function renderTable($table, $alias = null, $parent = true)
{
if ($parent) {
return parent::renderTable($table, $alias);
} else {
if (empty($alias)) {
$alias = 'tmp';
}
return "($table) AS $alias";
}
}
}
You can use directly where clause with your cording.
public function test(){
$sql = $this->tableGateway->getSql();
$select = $sql->select();
$select->where(array('title' => 'abracadabra'));
$select->where
->NEST->
equalTo('id', 1)
->OR->
equalTo('artist', 'Tony')
->UNNEST;
if($isDynamic){
$select->where(array('test_id' => '1'));
}
$select->limit(1);
return $this->tableGateway->selectWith($select);
}
You can use SQL like this

Rendering PartialView to string inconveniences

I'm developing ASP.NET MVC5 (Razor) project. I would like to render partial view into a DIV when Test ActionLink clicked, so code for Controller is this:-
public ActionResult Accion(string vista)
{
if (string.IsNullOrEmpty(vista) || !Request.IsAjaxRequest())
return View();
else
{
object vistaModelo = null;
if (vista.Contains("Usuarios"))
vistaModelo = new UsuariosVistaModelo();
string render = PartialView(vista, vistaModelo).RenderToString();
return Json(new { data = render });
}
}
Code for cshtml:-
<div class="menu">
#Html.ActionLink("Test","Accion","Navigation",new { vista = "~/Views/Soporte/Usuarios.cshtml" }, new { #class = "accion" })
<script>
//Dispara la acción en el controlador del servidor
$('.accion').live("click", function () {
$.ajax({
url:this.href,
type:'post',
success:function(data)
{
//data contiene el resultado devuelto por el servidor
$('.content').html(data);
},
error: function (req, status, error) {
alert(error);
}
});
//Se retorna falso para prevenir reenviar a otra pagina
return false;
});
</script>
</div>
<div class="content">
</div>
When I click on Test ActionLink, $('.accion').live("click" ... event is not triggered and go straighforward to Accion into controller. Please need help. Thanks
Some modifications in your code to make it working
** Modify your action to
#Html.ActionLink("Test","Accion","Navigation",new { vista = "~/Views/Soporte/Usuarios.cshtml" }, new { #class = "accion", onclick = "javascript:return false;" })
Now anchor default behaviour would not work.
** Now modify your Jquery like
//Dispara la acción en el controlador del servidor
$('.accion').click(function () {
$.ajax({
url:this.href,
type:'post',
data : {"vista" : "~/Views/Soporte/Usuarios.cshtml"},
success:function(data)
{
//data contiene el resultado devuelto por el servidor
$('.content').html(data);
},
error: function (req, status, error) {
alert(error);
}
});
//Se retorna falso para prevenir reenviar a otra pagina
return false;
});
//Add Post on the top of action
[HttpPost]
public ActionResult Accion(string vista)
{
if (string.IsNullOrEmpty(vista) || !Request.IsAjaxRequest())
return View();
else
{
object vistaModelo = null;
if (vista.Contains("Usuarios"))
vistaModelo = new UsuariosVistaModelo();
string render = PartialView(vista, vistaModelo).RenderToString();
return Json(new { data = render });
}
}
Also use on/click instead of live
Some modification on Jquery level
// code
success:function(data)
{
$('.content').html(data.data);
},
error: function (req, status, error) {
alert(error);
}
// code
try to replace
$('.content').html(data); to $('.content').html(data.data); Here 2nd data is the parameter which holds the value on controller.

Zend Framework 2 - Common class

I have this message when I change id in id_art on may table in zend framework 2 (I can add and delete but I can't update):
Exception
Fichier:
C:\wamp\www\zf2\module\Annonces\src\Annonces\Model\AnnoncesTable.php:29
Message:
Could not find row 0
Pile d'exécution:
#0 C:\wamp\www\zf2\module\Annonces\src\Annonces\Model\AnnoncesTable.php(48): Annonces\Model\AnnoncesTable->getAnnonces(0)
and this is my script moduleTable:
<?php
namespace Annonces\Model;
use Zend\Db\TableGateway\TableGateway;
class AnnoncesTable
{
protected $tableGateway;
public function __construct(TableGateway $tableGateway)
{
$this->tableGateway = $tableGateway;
}
//fonction qui permet d'afficher tous la table "Article"
public function fetchAll()
{
$resultSet = $this->tableGateway->select();
return $resultSet;
}
//fonction qui permet de recuperer tout les id de la table "Article"
public function getAnnonces($id)
{
$id = (int) $id;
$rowset = $this->tableGateway->select(array('id_art' => $id));
$row = $rowset->current();
if (!$row) {
throw new \Exception("Could not find row $id");
}
return $row;
}
/*fonction qui permet de ajouet ou modiier un objet de type "Annonce" dans la table "Article"
en fonction de l'id*/
public function saveAnnonces(Annonces $annonces)
{
$data = array(
'titre_art' => $annonces->titre_art,
);
$id = (int) $annonces->id;
if ($id == 0) {
$this->tableGateway->insert($data);
} else {
if ($this->getAnnonces($id)) {
$this->tableGateway->update($data, array('id_art' => $id));
} else {
throw new \Exception('Annonce id does not exist');
}
}
}
//fonction qui permet de supprimé un article en fonction de l'id
public function deleteAnnonces($id)
{
$this->tableGateway->delete(array('id_art' => $id));
}
}
?>
///////////////////////////Controller action:
<?php
namespace Annonces\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Annonces\Model\Annonces;
use Annonces\Form\AnnoncesForm;
class AnnoncesController extends AbstractActionController
{
protected $annoncesTable;
public function indexAction()
{
return new ViewModel(array(
'annonces' => $this->getAnnoncesTable()->fetchAll(),
));
}
public function annonceAction()
{
return new ViewModel(array(
'annonces' => $this->getAnnoncesTable()->fetchAll(),
));
}
public function addAction()
{
$form = new AnnoncesForm();
$form->get('submit')->setValue('Add');
//fonction qui permet d'applet la méthode de création et vérification des champs de saisie de formulaire
$request = $this->getRequest();
if ($request->isPost()) {
$annonces = new Annonces();
$form->setInputFilter($annonces->getInputFilter());
$form->setData($request->getPost());
//apré la validation du formaulaire , remplir l'objet de type "Annonce" et applet la méthode "save annonces" pour ajouter ou modifier l'annonce
if ($form->isValid()) {
$annonces->exchangeArray($form->getData());
$this->getAnnoncesTable()->saveAnnonces($annonces);
// Redirect to list of annonces
return $this->redirect()->toRoute('annonces');
}
}
return array('form' => $form);
}
public function editAction()
{
//test si l'id à était saisie pour la rediriction (add/mod)
$id = (int) $this->params()->fromRoute('id', 0);
if (!$id) {
return $this->redirect()->toRoute('annonces', array(
'action' => 'add'
));
}
//appllé la fonction getAnnoce //
$annonces = $this->getAnnoncesTable()->getAnnonces($id);
$form = new AnnoncesForm();
$form->bind($annonces);
$form->get('submit')->setAttribute('value', 'Edit');
//vérification les valeur de formulaire de la page "edit"
$request = $this->getRequest();
if ($request->isPost()) {
$form->setInputFilter($annonces->getInputFilter());
$form->setData($request->getPost());
//applé la méthode "save" apré la validation de formulaire
if ($form->isValid()) {
$this->getAnnoncesTable()->saveAnnonces($form->getData());
// Redirect to list of annoncess
return $this->redirect()->toRoute('annonces');
}
}
return array(
'id' => $id,
'form' => $form,
);
}
public function deleteAction()
{
//test si l'id à était saisie pour la rediriction
$id = (int) $this->params()->fromRoute('id', 0);
if (!$id) {
return $this->redirect()->toRoute('annonces');
}
//supprimé l'article si l'utilisateur confirm l'action "del"
$request = $this->getRequest();
if ($request->isPost()) {
$del = $request->getPost('del', 'No');
if ($del == 'Yes') {
$id = (int) $request->getPost('id');
$this->getAnnoncesTable()->deleteAnnonces($id);
}
// Redirect to list of annoncess
return $this->redirect()->toRoute('annonces');
}
return array(
'id' => $id,
'annonces' => $this->getAnnoncesTable()->getAnnonces($id)
);
}
public function getAnnoncesTable()
{
//permet de recupéré les champs de la table "Article"
if (!$this->annoncesTable) {
$sm = $this->getServiceLocator();
$this->annoncesTable = $sm->get('Annonces\Model\AnnoncesTable');
}
return $this->annoncesTable;
}
}
?>

Resources