Cake\ORM\Behavior\TranslateBehavior::_findExistingTranslations PHP Method

_findExistingTranslations() protected method

Returns the ids found for each of the condition arrays passed for the translations table. Each records is indexed by the corresponding position to the conditions array
protected _findExistingTranslations ( array $ruleSet ) : array
$ruleSet array an array of arary of conditions to be used for finding each
return array
    protected function _findExistingTranslations($ruleSet)
    {
        $association = $this->_table->association($this->_translationTable->alias());
        $query = $association->find()->select(['id', 'num' => 0])->where(current($ruleSet))->hydrate(false)->bufferResults(false);
        unset($ruleSet[0]);
        foreach ($ruleSet as $i => $conditions) {
            $q = $association->find()->select(['id', 'num' => $i])->where($conditions);
            $query->unionAll($q);
        }
        return $query->combine('num', 'id')->toArray();
    }