/** * add a field * * originally, I wanted this to be named setField but in order for this class to * extend MingoMagic I can't override the setField method to only take one parameter * (which is one of my least favorite things about php) and so addField was the * next best method name I could think of, but I also changed setIndex() to addIndex() * so it would match this method * * @param MingoField $field the field * @return MingoSchema */ public function addField(MingoField $field) { // canary... if (!$field->hasName()) { throw new InvalidArgumentException('$field must have a name set'); } //if $name = $field->getNameAsString(); $this->field_map[$name] = $field; return $this; }