Expected resolved value to be an object but got "array" #461
-
| 
         i have this isue "Expected resolved value to be an object but got "array"" i want to resolve a field that returns an array i do @return NameClass[] and i got this error anyone has an idea  | 
  
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
| 
         Make sure the return annotation typing is a FQCN or included in a   | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         /** this is the field in the model class 
 class NearestShops }  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         @dhiabenjaber firstly, case sensitivity matters.  Secondly, I don't see any of your   | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         problem fixed here is the code  | 
  
Beta Was this translation helpful? Give feedback.
problem fixed here is the code
/**
* @field
* @return NearestShops[]
*/
public function nearestShops()
{
// $nearestShops = new NearestShops($this->shopId, $this->latitude, $this->longitude,$this->url,$this->name,$this->id);
$arr=$this->getNearestShops();
$shopArray = array();
foreach ($arr as $item) {