/**
  * <code>
  * <?php
  *
  * $manufacturer = Manufacturer::findFirstById(51);
  *
  * $manufacturer->load('Robots.Parts');	
  *
  * foreach ($manufacturer->robots as $robot) {
  *    foreach ($robot->parts as $part) { ... }
  * }
  * </code>
  *
  * @param mixed ...$arguments
  * @return self
  */
 public function load(...$arguments)
 {
     return Loader::fromModel($this, ...$arguments);
 }
 public function testHasManyToMany()
 {
     $rawly = Robot::findFirstById(1);
     $rawly->parts;
     $eagerly = Loader::fromModel(Robot::findFirstById(1), 'Parts');
     $this->assertTrue(property_exists($eagerly, 'parts'));
     $this->assertTrue(is_array($eagerly->parts));
     $this->assertSame(count($eagerly->parts), $rawly->parts->count());
     $getIds = function ($arr) {
         $ret = [];
         foreach ($arr as $r) {
             if (is_object($r)) {
                 $ret[] = $r->readAttribute('id');
             }
         }
         return $ret;
     };
     $this->assertEquals($getIds($this->_resultSetToEagerLoadingEquivalent($rawly->parts)), $getIds($eagerly->parts));
 }