[4.2] Fixed "relationsToArray"

Not unsetting the relations variable might lead to setting the next key with the previous value if the current value is not an instanceof the ArrayableInterface or null.
`$this->assertArrayNotHasKey('foo', $parent->toArray());`

Also, please insert one space after a comma (lines 18 and 19) and spaces around assignment operators (line 17).