Move object in tree table.

@param   Table $table
@param   string $type
@param   int $id
@param   int $step
@return  \Cake\Http\Response|null
358120
protected function _move(Table $table, $id, $step = 1, $type = self::TYPE_UP)
    {
        $behaviors = $table->behaviors();
        if (!Arr::in('Tree', $behaviors->loaded())) {
            $behaviors->load('Tree');
        }

        $entity = $table->get($id);

        /** @var TreeBehavior $treeBehavior */
        $treeBehavior = $behaviors->get('Tree');
        $treeBehavior->setConfig('scope', $entity->get('id'));

        if ($table->{$type}($entity, $step)) {
            $this->Flash->success($this->_configRead('messages.success'));
        } else {
            $this->Flash->error($this->_configRead('messages.error'));
        }

        return $this->_redirect();
    }
925148
public function formAction($id, Request $request, $type = null)
    {
        $this->type = $type;

        return parent::formAction($id, $request);
    }
639901
public function join($type, $table, array $relations = array())
    {
        $this->append(sprintf(' %s JOIN %s ', $type, $table));

        // Append relations if provided
        if (!empty($relations)) {
            // First on
            $this->on();

            $i = 0; // Iteration counter
            $count = count($relations);

            foreach ($relations as $column => $value) {
                // Increment iteration count
                $i++;

                $this->equals($column, $value);

                // If last iteration
                if ($i != $count) {
                    $this->rawAnd();
                }
            }
        }

        return $this;
    }
299788
public void setStep(java.lang.Object _step) {
		getStateHelper().put(PropertyKeys.step, _step);
	}
915166
public function edit($type = null, $id = null)
    {
        $this->_validateActionIsEnabled('edit');

        $this->_event('beforeEdit', [
            'id' => $id
        ]);

        $query = $this->_callQuery($this->Model->findById($id));
        $entity = $query->first();

        if ($this->request->is(['patch', 'post', 'put'])) {
            $entity->accessible('*', true);
            $entity = $this->Model->patchEntity($entity, $this->request->data());
            if ($this->Model->save($entity)) {
                $this->Flash->success(__d('CakeAdmin', 'The {0} has been edited.', [$this->type['singularAliasLc']]));
                return $this->redirect(['action' => 'index', 'type' => $this->type['name']]);
            } else {
                $this->Flash->error(__d('CakeAdmin', 'The {0} could not be edited. Please, try again.', [$this->type['singularAliasLc']]));
            }
        }

        $this->_loadAssociations();

        $this->set(compact('type', 'entity'));

        $this->_event('afterEdit', [
            'id' => $id
        ]);
    }
1174388
public function down(Table $table, $id, $step = 1)
    {
        return $this->_move($table, $id, $step, self::TYPE_DOWN);
    }
1341468
protected void transition(Member.Type type) {
    switch (type) {
      case ACTIVE:
        if (!(state instanceof ActiveState)) {
          transition(CopycatServer.State.FOLLOWER);
        }
        break;
      case PASSIVE:
        if (this.state.type() != CopycatServer.State.PASSIVE) {
          transition(CopycatServer.State.PASSIVE);
        }
        break;
      case RESERVE:
        if (this.state.type() != CopycatServer.State.RESERVE) {
          transition(CopycatServer.State.RESERVE);
        }
        break;
      default:
        if (this.state.type() != CopycatServer.State.INACTIVE) {
          transition(CopycatServer.State.INACTIVE);
        }
        break;
    }
  }
1264468
public function attachFiles($id, $table, $files)
    {
        foreach ($files as $file) {
            if (!empty($file)) {
                $this->attachFile($id, $table, $file);
            }
        }
    }
68340
public function addStep(Step $step, $priority = null)
    {
        $priority = null === $priority && $step instanceof PriorityStep ? $step->getPriority() : $priority;
        $priority = null === $priority ? 0 : $priority;

        $this->steps->insert($step, $priority);

        return $this;
    }
20357
public function join($type, $table, $conditions=null, $recursive=true) {
		if($recursive && is_array($table)) {
			foreach($table as $_table=>$_conditions) {
				if($_conditions instanceof static)
					$this->join($type, $table, $conditions, false);
				elseif($_conditions instanceof Raw)
					$this->join($type, $table, $conditions, false);
				else
					$this->join($type, $_table, $_conditions);
			}

			return $this;
		}

		#for tables that are static or Raw
		if(is_array($table)) {
			$alias = array_keys($table)[0];
			$table = array_values($table)[0];
		}
		else {
			$table_alias = explode(' ', $table);
			$table = $table_alias[0];
			if(isset($table_alias[1]))
				$alias = $table_alias[1];
			else
				$alias = $table;
		}

		$this->joins[$alias] = [$type, $table, $conditions];

		return $this;
	}
1348001
protected function callPostProcessGarbageCollectorHook($table, $uid)
    {
        if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['postProcessGarbageCollector'])) {
            return;
        }

        foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['postProcessGarbageCollector'] as $classReference) {
            $garbageCollectorPostProcessor = GeneralUtility::makeInstance($classReference);

            if ($garbageCollectorPostProcessor instanceof GarbageCollectorPostProcessor) {
                $garbageCollectorPostProcessor->postProcessGarbageCollector($table, $uid);
            } else {
                $message = get_class($garbageCollectorPostProcessor) . ' must implement interface ' .
                    GarbageCollectorPostProcessor::class;
                throw new \UnexpectedValueException($message, 1345807460);
            }
        }
    }
893792
function(executionStep) {
    // In order to use and index for implementing a join, the entire relation
    // must be fed to the JoinStep, otherwise the index can't be used.
    if (!(executionStep instanceof lf.proc.TableAccessFullStep)) {
      return null;
    }
    var candidateColumn = getColumnForTable(executionStep.table);
    return goog.isNull(candidateColumn.getIndex()) ? null : candidateColumn;
  }
575252
protected function runStep( $step, WizardStep $model = null )
    {
        $request    = $this->getRequest();
        $isValid    = false;
        $isPost     = $request->isPost();
        $isCancel   = $isPost && $request->getPost( 'cancel' );
        $isPrevious = $isPost && $request->getPost( 'previous' );
        $isNext     = $isPost && $request->getPost( 'next' );
        $isFinish   = $isPost && $request->getPost( 'finish' );
        $jumpTo     = $request->getQuery( 'jump' );
        $values     = $this->getStepStore( $step );
        $form       = $model ? $model->getStepForm() : null;
        $redirect   = null;

        if ( ! empty( $model ) && $model->canSkip() )
        {
            $this->setStepStore( $step, array() );
            $this->pushStepStack( $step );
            $redirect = $model->getNextStep();
        }
        else if ( empty( $model ) || empty( $form ) )
        {
            $redirect = $this->startStep;
        }
        else
        {
            if ( ! empty( $values ) )
            {
                $form->setData( $values );
            }

            if ( $isPost && ( $isNext || $isFinish ) )
            {
                $form->setData( $request->getPost() );
                $isValid = $form->isValid();
            }

            if ( $isNext && $isValid && ( $redirect = $model->getNextStep() ) )
            {
                $this->setStepStore( $step, $form->getData() );
                $this->pushStepStack( $step );
            }
            else if ( $isPrevious && ( $redirect = $model->getPreviousStep() ) )
            {
                $top = $this->topStepStack();

                if ( $redirect == $top )
                {
                    $this->popStepStack();
                }
            }
            else if ( $jumpTo )
            {
                $store = $this->getStore();

                while ( ! empty( $store['stack'] ) &&
                        $jumpTo != $this->popStepStack() );

                $redirect = empty( $store['stack'] )
                    ? $this->startStep
                    : $jumpTo;
            }
            else if ( $isFinish && $isValid && $model->canFinishWizard() )
            {
                $this->setStepStore( $step, $form->getData() );
                $this->pushStepStack( $step );
                $redirect = self::STEP_FINISH;
            }
            else if ( $isCancel && $model->canCancelWizard() )
            {
                $redirect = self::STEP_CANCEL;
            }
        }

     /* if ( $redirect && $redirect != $step )
        {
            if ( ! $this->stepping( $step, $redirect ) )
            {
                $redirect = null;
            }
        } */

        return $redirect;
    }
444127
public function stepCreateRecordHasField($type, $id, $field, $value) {
		$class = $this->convertTypeToClass($type);
		$fields = $this->convertFields(
			$class,
			array($field => $value)
		);
		// We should check if this fixture object already exists - if it does, we update it. If not, we create it
		if($existingFixture = $this->fixtureFactory->get($class, $id)) {
			// Merge existing data with new data, and create new object to replace existing object
			foreach($fields as $k => $v) {
				$existingFixture->$k = $v;
			}
			$existingFixture->write();
		} else {
			$this->fixtureFactory->createObject($class, $id, $fields);
		}
	}
419974
public function join($type, $table, array $relations = array())
    {
        $this->queryBuilder->join($type, $table, $relations);
        return $this;
    }
1125992
public function initialize(Table $table)
    {
        $this->table = $table;

        if (!$this->builder instanceof ActionBuilder) {
            $this->builder = new ActionBuilder($this->table);
        }
    }
1149840
public function addTrigger($type, $table, callable $trigger)
    {
        if (!array_key_exists($type, $this->triggers)) {
            throw new \Exception("Invalid trigger type specified");
        }

        $this->triggers[$type][$table][] = $trigger;
    }