/** * @param Models $models * @param int $flags * @return \Harp\Harp\Find */ public function findModels(Models $models, $flags = null) { $throughKey = $this->getThroughTable() . '.' . $this->getThroughRel()->getForeignKey(); $throughForeignKey = $this->getThroughTable() . '.' . $this->getKey(); $keys = $models->getIds(); return $this->findAllWhereIn($throughForeignKey, $keys, $flags)->column($throughKey, $this->getThroughKey())->joinRels([$this->through]); }
/** * @covers ::getIds */ public function testGetIds() { $models = new Models([new City(['id' => 10, 'name' => 'test1']), new City(['id' => 20, 'name' => 'test2'])]); $expected = [10, 20]; $this->assertSame($expected, $models->getIds()); }