/** * @covers ::toAssoc * @dataProvider dataToAssoc */ public function testToAssoc($array, $expected) { $this->assertSame($expected, Arr::toAssoc($array)); }
/** * @param array|string $rels */ public function joinRels($rels) { $rels = Arr::toAssoc((array) $rels); $this->joinNestedRels($this->getRepo(), $rels, $this->getRepo()->getTable()); return $this; }
/** * Load all the models for the provided relations. This is the meat of the eager loading * * @param Models $models * @param array $rels * @param int $flags * @return Repo $this */ public function loadAllRelsFor(Models $models, array $rels, $flags = null) { $rels = Arr::toAssoc($rels); foreach ($rels as $relName => $childRels) { $foreign = $this->loadRelFor($models, $relName, $flags); if ($childRels) { $rel = $this->getRel($relName); $rel->getRepo()->loadAllRelsFor($foreign, $childRels, $flags); } } return $this; }