I am unsure on how to use the @Collection annotation in Mongo. As you know, I am trying to save a simple array in a Mongo document.
So in my document:
/**
* @MongoDB\Collection
*/
protected $counties = array();
/**
* Set counties
*
* @param collection $counties
* @return self
*/
public function setCounties($counties)
{
$this->counties = $counties;
return $this;
}
/**
* Get counties
*
* @return collection $counties
*/
public function getCounties()
{
return $this->counties;
}
Now when I go to save something for example:
$county = "test entry"
$obj = new Obj();
$obj->setCounties(array($county));
It now gives me warning "expected collection, got array".
How come?