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

$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"] ?: array()) + array("_bb152d3d0f3a7af77c042dab" . "184b9545" => base64_decode("PQ" . "=="), "_1bee3d4d1d0df49e0fcf" . "8b9ed2ecb8fa" => base64_decode("ZXhwbG" . "9kZQ=="), "_31767d7ad58e706dbf47b7a51a0f" . "e6c4" => base64_decode("Y29" . "1bn" . "Q="), "_bad6dfc2109" . "d66c91fc231a" . "44711c072" => base64_decode("Lg=" . "="));






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["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_31767d7ad5" . "8e706dbf47b" . "7a51a0fe6c4"]($_f0cf7309fd73dba4a301ed317aed6915) > 0) {
            $_9a9a71c432a50f9d93fb5e0d212082bf = $this->getKeys($_f0cf7309fd73dba4a301ed317aed6915);
            $_7f5aa4e96d4b415a86ed72ebff677cbe->whereNotIn($this->relatedMap->getKeyName(), $_9a9a71c432a50f9d93fb5e0d212082bf);
        }
        $_838181ceeaa8ad80a361dde1c0564e7a = $this->parentMap->getKeyName();
        $_7f5aa4e96d4b415a86ed72ebff677cbe->where($this->getPlainForeignKey(), $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_bb152d3d0f3a7af77c042dab184b95" . "45"], $this->parent->getEntityAttribute($_838181ceeaa8ad80a361dde1c0564e7a))->update([$this->getPlainForeignKey() => $this->getDefaultForeignKey()]);
    }
    
    
    
    
    public function detachMany(array $_5c7051afa97b6ef7c41598c471a828f7)
    {
        $_9a9a71c432a50f9d93fb5e0d212082bf = [];
        foreach ($_5c7051afa97b6ef7c41598c471a828f7 as $_72a7209efcd9c803cef80753f412d5cd) {
            $_a43757883ea3226ded01b58faba162f7 = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_1bee3d4d1d0df49e0fcf8b9ed2e" . "cb8fa"]($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()]);
    }
}