protected function _drillDownEntity($action, EntityInterface $entity, array $parts, $value = null)
    {
        $prop = array_shift($parts);
        if (empty($parts)) {
            $this->_doAction($action, $entity, $prop, $value);

            return;
        }

        if ($entity->{$prop} instanceof EntityInterface) {
            $this->_drillDownEntity($action, $entity->{$prop}, $parts, $value);

            return;
        }

        foreach ($entity->{$prop} as $key => $e) {
            $this->_drillDownEntity($action, $e, $parts, $value);
        }
    }
protected function _drillDownEntity($action, EntityInterface $entity, array $parts, $value = null)
    {
        $prop = array_shift($parts);
        if (empty($parts)) {
            $this->_doAction($action, $entity, $prop, $value);

            return;
        }

        if ($entity->{$prop} instanceof EntityInterface) {
            $this->_drillDownEntity($action, $entity->{$prop}, $parts, $value);

            return;
        }

        foreach ($entity->{$prop} as $key => $e) {
            $this->_drillDownEntity($action, $e, $parts, $value);
        }
    }
protected function _drillDownEntity ( $ action , EntityInterface $ entity , array $ parts , $ value = null ) { $ prop = array_shift ( $ parts ) ; if ( empty ( $ parts ) ) { $ this -> _doAction ( $ action , $ entity , $ prop , $ value ) ; return ; } if ( $ entity -> { $ prop } instanceof EntityInterface ) { $ this -> _drillDownEntity ( $ action , $ entity -> { $ prop } , $ parts , $ value ) ; return ; } foreach ( $ entity -> { $ prop } as $ key => $ e ) { $ this -> _drillDownEntity ( $ action , $ e , $ parts , $ value ) ; } }
Drill down the properties and modify the leaf property.

@param string $action Action to perform.
@param \Cake\Datasource\EntityInterface $entity Entity
@param array $parts Related properties chain.
@param mixed $value Value to set or use for modification.
@return void
Drill down the properties and modify the leaf property .