i don't know why it says in documentation that it could be an array and by going through the source code its clearly not
hasManyToMany(
string|array $fields,
string $intermediateModel,
string|array $intermediateFields,
string|array $intermediateReferencedFields,
string $referenceModel,
string|array $referencedFields,
array $options = null
)
if the relation is through an intermediate model ( which is true here ) it will check fileds
and intermediateReferencedFields
if either of them is an array it will throw the exception
Phalcon\Mvc\Model\Manager::getRelationRecords()
if relation->isThrough() {
let conditions = [];
let intermediateModel = relation->getIntermediateModel(),
intermediateFields = relation->getIntermediateFields();
/**
* Appends conditions created from the fields defined in the
* relation
*/
let fields = relation->getFields();
if unlikely typeof fields == "array" {
throw new Exception("Not supported");
}
let conditions[] = "[" . intermediateModel . "].[" . intermediateFields . "] = :APR0:",
placeholders["APR0"] = record->readAttribute(fields);
let joinConditions = [];
/**
* Create the join conditions
*/
let intermediateFields = relation->getIntermediateReferencedFields();
if unlikely typeof intermediateFields == "array" {
throw new Exception("Not supported");
}
// the rest is omitted
}