I have Some field in my documents type of "Collection". So when I am trying to save document I am getting following error.
Collection type requires value of type array or null, DoctrineCommon CollectionsArrayCollection given. even All the field which are collection types are defined as : $byLedgersArrays = array(0=>112,1=>566);
$document->addToLedgers($byLedgersArrays);
//My Document is this:
/**
* @var array $byLedgers
*
* @ODMField(name="byLedgers", type="collection")
*/
protected $byLedgers;
public function __construct()
{
$this->setIsDeleted(false);
$this->byLedgers = new ArrayCollection();
}
//Controller:
$document = new Voucher();
$document->addByLedgers($byLedgersArrays);
Please help what is missing in this.
