Skip to content

Expected resolved value to be an object but got "array" #461

Answered by dhiabenjaber
dhiabenjaber asked this question in Q&A
Discussion options

You must be logged in to vote

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) {

        $nearestShop = new NearestShops($this->shopId, $this->latitude, $this->longitude,$item["id"],$this->name,$item["url"]);

        array_push($shopArray, $nearestShop);

    }
    return $shopArray;


}

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by dhiabenjaber
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants