protected function _drillDownAssoc(EntityInterface $entity, $object, array $parts)
    {
        $assocName = array_shift($parts);
        $prop = $object->{$assocName}->getProperty();
        $associated = $entity->{$prop};

        if (empty($associated) || $object->{$assocName} instanceof BelongsTo) {
            return;
        }

        if ($associated instanceof EntityInterface) {
            if (!empty($parts)) {
                $this->_drillDownAssoc($associated, $object->{$assocName}, $parts);
            }

            if (!$associated->isNew()) {
                $this->_modifyEntity($associated, $object->{$assocName});
            }

            return;
        }

        foreach ($associated as $e) {
            if (!empty($parts)) {
                $this->_drillDownAssoc($e, $object->{$assocName}, $parts);
            }

            if (!$e->isNew()) {
                $this->_modifyEntity($e, $object->{$assocName});
            }
        }
    }
protected function _drillDownAssoc(EntityInterface $entity, $object, array $parts)
    {
        $assocName = array_shift($parts);
        $prop = $object->{$assocName}->getProperty();
        $associated = $entity->{$prop};

        if (empty($associated) || $object->{$assocName} instanceof BelongsTo) {
            return;
        }

        if ($associated instanceof EntityInterface) {
            if (!empty($parts)) {
                $this->_drillDownAssoc($associated, $object->{$assocName}, $parts);
            }

            if (!$associated->isNew()) {
                $this->_modifyEntity($associated, $object->{$assocName});
            }

            return;
        }

        foreach ($associated as $e) {
            if (!empty($parts)) {
                $this->_drillDownAssoc($e, $object->{$assocName}, $parts);
            }

            if (!$e->isNew()) {
                $this->_modifyEntity($e, $object->{$assocName});
            }
        }
    }
protected function _drillDownAssoc ( EntityInterface $ entity , $ object , array $ parts ) { $ assocName = array_shift ( $ parts ) ; $ prop = $ object -> { $ assocName } -> getProperty ( ) ; $ associated = $ entity -> { $ prop } ; if ( empty ( $ associated ) || $ object -> { $ assocName } instanceof BelongsTo ) { return ; } if ( $ associated instanceof EntityInterface ) { if ( ! empty ( $ parts ) ) { $ this -> _drillDownAssoc ( $ associated , $ object -> { $ assocName } , $ parts ) ; } if ( ! $ associated -> isNew ( ) ) { $ this -> _modifyEntity ( $ associated , $ object -> { $ assocName } ) ; } return ; } foreach ( $ associated as $ e ) { if ( ! empty ( $ parts ) ) { $ this -> _drillDownAssoc ( $ e , $ object -> { $ assocName } , $ parts ) ; } if ( ! $ e -> isNew ( ) ) { $ this -> _modifyEntity ( $ e , $ object -> { $ assocName } ) ; } } }
Drill down the related properties based on containments and modify each entity.

@param \Cake\Datasource\EntityInterface $entity Entity
@param \Cake\ORM\Table|\Cake\ORM\Association $object Table or association instance.
@param array $parts Related properties chain.
@return void
Drill down the related properties based on containments and modify each entity .