<?php
namespace Claromentis\Core\ORM\Analogue\Relationships;

$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"] ?: array()) + array("_31767d7ad58e706dbf47b7a51" . "a0fe6c4" => base64_decode("Y291" . "bnQ="), "_1bee3d4d1d0df49e0" . "fcf8b9ed2ecb8fa" => base64_decode("ZXhwbG9k" . "ZQ=="), "_bad6dfc2109d66c91fc231a4471" . "1c072" => base64_decode("Lg" . "=="), "_bb152d3d0f3a7af" . "77c042dab184b954" . "5" => base64_decode("PQ=" . "="));






class HasMany extends \Analogue\ORM\Relationships\HasMany
{
    
    
    
    
    
    
    
    
    
    
    protected $defaultForeignKey = 0;
    
    
    
    
    
    
    
    
    public function getDefaultForeignKey()
    {
        return $this->defaultForeignKey;
    }
    
    
    
    
    protected function detachExcept($_f0cf7309fd73dba4a301ed317aed6915)
    {
        $_7f5aa4e96d4b415a86ed72ebff677cbe = $this->query->getQuery()->from($this->relatedMap->getTable());
        if ($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_31767d7ad58e706dbf47b" . "7a51a0fe6c4"]($_f0cf7309fd73dba4a301ed317aed6915) > 0) {
            $_9a9a71c432a50f9d93fb5e0d212082bf = $this->getKeys($_f0cf7309fd73dba4a301ed317aed6915);
            $_7f5aa4e96d4b415a86ed72ebff677cbe->whereNotIn($this->relatedMap->getKeyName(), $_9a9a71c432a50f9d93fb5e0d212082bf);
        }
        $_838181ceeaa8ad80a361dde1c0564e7a = $this->parentMap->getKeyName();
        $_7f5aa4e96d4b415a86ed72ebff677cbe->where($this->getPlainForeignKey(), $GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_bb152d3d0f3a7af77c042dab184" . "b9545"], $this->parent->getEntityAttribute($_838181ceeaa8ad80a361dde1c0564e7a))->update([$this->getPlainForeignKey() => $this->getDefaultForeignKey()]);
    }
    
    
    
    
    public function detachMany(array $_5c7051afa97b6ef7c41598c471a828f7)
    {
        $_9a9a71c432a50f9d93fb5e0d212082bf = [];
        foreach ($_5c7051afa97b6ef7c41598c471a828f7 as $_72a7209efcd9c803cef80753f412d5cd) {
            $_a43757883ea3226ded01b58faba162f7 = $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_1bee3d4d1d0df49e0fcf8b9ed2ecb8f" . "a"]($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_bad6dfc2109d66c91fc23" . "1a44711c072"], $_72a7209efcd9c803cef80753f412d5cd);
            $_9a9a71c432a50f9d93fb5e0d212082bf[] = $_a43757883ea3226ded01b58faba162f7[1];
        }
        $_7f5aa4e96d4b415a86ed72ebff677cbe = $this->query->getQuery()->from($this->relatedMap->getTable());
        $_7f5aa4e96d4b415a86ed72ebff677cbe->whereIn($this->relatedMap->getKeyName(), $_9a9a71c432a50f9d93fb5e0d212082bf)->update([$this->getPlainForeignKey() => $this->getDefaultForeignKey()]);
    }
}