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

$GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"] = (@$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"] ?: array()) + array("_1bee3d4d1d0d" . "f49e0fcf8b9ed" . "2ecb8fa" => base64_decode("ZXhwbG9kZQ" . "=="), "_bad6dfc2109d66c91fc231" . "a44711c072" => base64_decode("Lg=" . "="), "_31767d7ad58e706db" . "f47b7a51a0fe6c4" => base64_decode("Y291bn" . "Q="), "_bb152d3d0f3" . "a7af77c042da" . "b184b9545" => 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["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_31767d7ad5" . "8e706dbf47b" . "7a51a0fe6c4"]($_f0cf7309fd73dba4a301ed317aed6915) > 0) {
            $_9a9a71c432a50f9d93fb5e0d212082bf = $this->getKeys($_f0cf7309fd73dba4a301ed317aed6915);
            $_7f5aa4e96d4b415a86ed72ebff677cbe->whereNotIn($this->relatedMap->getKeyName(), $_9a9a71c432a50f9d93fb5e0d212082bf);
        }
        $_838181ceeaa8ad80a361dde1c0564e7a = $this->parentMap->getKeyName();
        $_7f5aa4e96d4b415a86ed72ebff677cbe->where($this->getPlainForeignKey(), $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_bb152d3d" . "0f3a7af77" . "c042dab18" . "4b9545"], $this->parent->getEntityAttribute($_838181ceeaa8ad80a361dde1c0564e7a))->update([$this->getPlainForeignKey() => $this->getDefaultForeignKey()]);
    }
    
    
    
    
    public function detachMany(array $_5c7051afa97b6ef7c41598c471a828f7)
    {
        $_9a9a71c432a50f9d93fb5e0d212082bf = [];
        foreach ($_5c7051afa97b6ef7c41598c471a828f7 as $_72a7209efcd9c803cef80753f412d5cd) {
            $_a43757883ea3226ded01b58faba162f7 = $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_1bee3d4d1d0df49e0fcf8b9ed" . "2ecb8fa"]($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_bad6dfc2109d66c91fc231a4" . "4711c072"], $_72a7209efcd9c803cef80753f412d5cd);
            $_9a9a71c432a50f9d93fb5e0d212082bf[] = $_a43757883ea3226ded01b58faba162f7[1];
        }
        $_7f5aa4e96d4b415a86ed72ebff677cbe = $this->query->getQuery()->from($this->relatedMap->getTable());
        $_7f5aa4e96d4b415a86ed72ebff677cbe->whereIn($this->relatedMap->getKeyName(), $_9a9a71c432a50f9d93fb5e0d212082bf)->update([$this->getPlainForeignKey() => $this->getDefaultForeignKey()]);
    }
}