php - QueryBuilder: [Semantical Error]: 'partshade' is not defined -


whenever try concatenate query existing query, error ['partshade not defined']. 'partshade' 1 of array elements represented 'x'.

$repository = $this->getdoctrine()->getrepository('appbundle:shrubs');  $query = $repository->createquerybuilder('p');  $shrubs = $query     ->where($query->expr()->like('p.botanicalname', ':botanicalname'))     ->setparameter('botanicalname', '%' . $botanicalname . '%')     ->andwhere($query->expr()->like('p.commonname', ':commonname'))     ->setparameter('commonname', '%' . $commonname . '%')     ->orderby('p.commonname', 'asc');  $checkfor = array(     "wetsoil"         => "tolerates wet soil",     "borderlinehardy" => "borderline hardy",     "moistsoil"       => "prefers moist soil",     "peatysoil"       => "prefers peaty soil",     "welldrainedsoil" => "prefers well-drained soil",     "drought"         => "tolerates drought",     "claysoil"        => "tolerates clay soil",     "sandysoil"       => "prefers sandy soil",     "loamsoil"        => "prefers loam soil",     "infertilesoil"   => "tolerates infertile soil",     "richsoil"        => "prefers rich soil",     "compactedsoil"   => "tolerates compacted soil",     "cityconditions"  => "tolerates city conditions",     "pollution"       => "tolerates pollution",     "salt"            => "tolerates salt conditions",     "windy"           => "tolerates windy conditions",     "shade"           => "prefers shade",     "partshade"       => "prefers part shade",     "fullsun"         => "prefers full sun", );  reset($checkfor);  foreach ($checkfor $key => $value) {     if (${$key} == "x") {         $shrubs = $shrubs             ->andwhere($query->expr()->eq($key, 'x'))             ->getquery()             ->getresult();     } } 


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -