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

$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"] = (@$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"] ?: array()) + array("_bb152d3d0f3a" . "7af77c042dab1" . "84b9545" => base64_decode("P" . "Q" . "=" . "="), "_31767d7ad58e706dbf47b7a51a0fe6c" . "4" => base64_decode("Y291" . "bnQ="), "_bad6dfc2109d66c91fc2" . "31a44711c072" => base64_decode("L" . "g" . "=" . "="), "_1bee3d4d1d0d" . "f49e0fcf8b9ed" . "2ecb8fa" => base64_decode("ZXhwbG9" . "kZQ=="));






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["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_31767d7ad58e706dbf4" . "7b7a51a0fe6c4"]($_f0cf7309fd73dba4a301ed317aed6915) > 0) {
            $_9a9a71c432a50f9d93fb5e0d212082bf = $this->getKeys($_f0cf7309fd73dba4a301ed317aed6915);
            $_7f5aa4e96d4b415a86ed72ebff677cbe->whereNotIn($this->relatedMap->getKeyName(), $_9a9a71c432a50f9d93fb5e0d212082bf);
        }
        $_838181ceeaa8ad80a361dde1c0564e7a = $this->parentMap->getKeyName();
        $_7f5aa4e96d4b415a86ed72ebff677cbe->where($this->getPlainForeignKey(), $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_bb152d3d0" . "f3a7af77c0" . "42dab184b9" . "545"], $this->parent->getEntityAttribute($_838181ceeaa8ad80a361dde1c0564e7a))->update([$this->getPlainForeignKey() => $this->getDefaultForeignKey()]);
    }
    
    
    
    
    public function detachMany(array $_5c7051afa97b6ef7c41598c471a828f7)
    {
        $_9a9a71c432a50f9d93fb5e0d212082bf = [];
        foreach ($_5c7051afa97b6ef7c41598c471a828f7 as $_72a7209efcd9c803cef80753f412d5cd) {
            $_a43757883ea3226ded01b58faba162f7 = $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_1bee3d4d1d0df49e0fcf8b9" . "ed2ecb8fa"]($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_bad6dfc2109d" . "66c91fc231a44" . "711c072"], $_72a7209efcd9c803cef80753f412d5cd);
            $_9a9a71c432a50f9d93fb5e0d212082bf[] = $_a43757883ea3226ded01b58faba162f7[1];
        }
        $_7f5aa4e96d4b415a86ed72ebff677cbe = $this->query->getQuery()->from($this->relatedMap->getTable());
        $_7f5aa4e96d4b415a86ed72ebff677cbe->whereIn($this->relatedMap->getKeyName(), $_9a9a71c432a50f9d93fb5e0d212082bf)->update([$this->getPlainForeignKey() => $this->getDefaultForeignKey()]);
    }
}