/** * @uses Table::getDummy() * @return array */ public function buildMultiple(sql\schema\table $junction, sql\schema\foreign $source, sql\schema\foreign $target) { if ($this->getParent()->isSub()) { $dummy = $this->getParent()->getDummy(); $collection = $dummy->call('getElement', array($this->getName()))->call('getValue'); } else { $collection = $this->getParent()->getElementArgument($this->getName(), 'get'); } $window = $this->getWindow(); $val = $window->createVariable('', 'php-null'); $key = $window->createVariable('', 'php-integer'); $loop = $window->createLoop($collection, $val, $key); $junction->init($key, $this->getParent()->getDummy(false)); $junction->addElement($source, $this->reflectKey()); $junction->addElement($target, $val); $loop->addContent($junction); $result = $loop; return $result; }