- È una cattiva pratica creare query direttamente nel tuo controller, dovresti creare funzione nel tuo repository
- La proprietà a distanza deve essere protetta o privata non pubblica
- Dov'è la tua mappatura ???
OrderBy Calcola entità proprizzata
-
25-08-2022 - |
Domanda
entità:
class Pharmacie{
public $distance;
public function getDistance() {
// calculate distance here
return $distance;
}
}
e in controller:
public function listePharmsGeoAction()
{
$em = $this->getDoctrine()->getEntityManager();
$pharmas = $em->getRepository('CentraleFrontBundle:Pharmacie')
->createQueryBuilder('o')
->orderBy('o.distance','ASC')
->getQuery()
->getResult();
return $this->render('CentraleFrontBundle:SiteFront:listePharms.html.twig', array(
'pharmas' => $pharmas));
}
Errore: [Errore semantico] Linea 0, Col 65 vicino a 'Distanza ASC': Errore: Class Centrale FrontBundle Entity Pharmacie non ha campo o associazione Distanza
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow