开启一个同步事务

@param Context $context
请求上下文对象
@return $this
965374
public function begin(Context $context = null)
    {
        $this->getDBQueryBuilder($context)->go(null, 'begin');
        
        return $this;
    }
413294
public function run($context)
    {
        foreach ($this->actions as $step) {
            /** @var $step Action  **/
            codecept_debug("- $step");
            try {
                call_user_func_array([$context, $step->getAction()], $step->getArguments());
            } catch (\Exception $e) {
                $class = get_class($e); // rethrow exception for a specific action
                throw new $class($e->getMessage() . "\nat $step");
            }
        }
    }
319783
public function triggerContextBound(ExpressContext $context)
	{
		if($this->eventDispatcher)
		{
			$this->eventDispatcher->notify(new ExpressContextBoundEvent($context));
		}
	}
704970
public function bind(Context $context)
    {
        if (! isset($context->__UBID)) {
            $context->__UBID = 0;
        }
        $context->__UBID ++;
        
        return spl_object_hash($context) . $context->__UBID;
    }
1063025
protected static function pushLeft(&$context) {
        $L = $context['currentToken'][Token::POS_LOTHER] . $context['currentToken'][Token::POS_LSPACE];

        if ($context['currentToken'][Token::POS_OP] === '!') {
            $appender = function (&$pb) use ($L) {
                $pb .= $L;
            };
            if (count($context['partialblock']) > 0) {
                array_walk($context['partialblock'], $appender);
            }
            if (count($context['inlinepartial']) > 0) {
                array_walk($context['inlinepartial'], $appender);
            }
        }

        static::pushToken($context, $L);
        $context['currentToken'][Token::POS_LOTHER] = $context['currentToken'][Token::POS_LSPACE] = '';
    }
91823
public function fireEvents($context)
    {
        if (!isset($context['__env'])) {
            return $context;
        }

        /** @var \Illuminate\View\Factory $factory */
        $env  = $context['__env'];
        $viewName = $this->name ?: $this->getTemplateName();

        $view = new View(
            $env,
            $env->getEngineResolver()->resolve('twig'),
            $viewName,
            null,
            $context
        );
        $env->callCreator($view);
        $env->callComposer($view);
        return $view->getData();
    }
389960
public function with( $key, $value = null ) {
		if ( is_array( $key ) ) {
			$this->context = array_merge( $this->getContext(), $key );
		} else {
			$this->context[ $key ] = $value;
		}
		return $this;
	}
1188023
public function setContext($context)
    {
        if (!is_array($context) && !$context instanceof \ArrayObject && !$context instanceof \Iterator) {
            throw new EventException('Unexpected value type for context', EventException::INVALID_CONTEXT);
        }

        $context = Collection::cast($context);

        $this->context = $context;

        return $this;
    }
726651
public function mergeViolations(Context $context)
    {
        $this->violations = array_merge($this->violations, $context->getViolations());
    }
1246554
public function setContext($context, $value = null)
    {
        if (is_null($value) && is_array($context)) {
            foreach ($context as $key => $value) {
                if (is_int($key)) {
                    throw new ContextException(sprintf('Context key must be a string, not an integer (key: "%s").', $key));
                }
                
                if ($value && !is_scalar($value)) {
                    throw new ContextException(sprintf('Context value must be scalar (key: "%s").', $key));
                }
                
                $this->context[$key] = $value;
            }
        } else {
            $key = $context;
            if (is_int($key)) {
                throw new ContextException(sprintf('Context key must be a string, not an integer (key: "%s").', $key));
            }
    
            if ($value && !is_scalar($value)) {
                throw new ContextException(sprintf('Context value must be scalar (key: "%s").', $key));
            }
    
            $this->context[$key] = $value;
        }
        
        return $this;
    }
867049
public function initializeContext(Context $context)
    {
        if (!$context instanceof GuzzleAwareContext) {
            return;
        }

        $context->setGuzzleClient($this->client);
        $context->setGuzzleParameters($this->parameters);
    }
1077284
protected function _actionBrowse($context)
    {
        if (!$context->query) {
            $context->query = $this->getRepository()->getQuery();
        }

        $query = $context->query;
        $query->order('open', 'DESC');

        if ($this->sort == 'priority') {
            $query->order('priority', 'DESC');
        }

        return parent::_actionBrowse($context);
    }
184829
public function goBegin(Context $context = null)
    {
        $id = $this->bind($context);
        return $this->getDBQueryBuilder($context)->go($id, 'begin');
    }
964026
public function push(RenderingContext $context)
    {
        if ($this->getLevel() == self::COMPONENT) {
            throw new \BadMethodCallException(
                'Cannot push another context : stack is full. Resolve or flush current one first'
            );
        }

        array_unshift($this->stack, $context);

        return $this;
    }
371286
public function apply( $context ) {
		if ( ! $context instanceof RContext ) {
			$context = new Context( $context );
		}

		return $this->evaluate( $context );
	}
651655
public function toProvider(string $provider, string $context = '') : self
    {
        $this->untarget = null;
        $this->validate->toProvider($provider);
        $this->bound = (new DependencyFactory)->newProvider(new \ReflectionClass($provider), $context);
        $this->container->add($this);

        return $this;
    }
611048
protected function createNew(Context $context)
    {
        $resource = $this->getRepository()->createNew();

        if (null !== $context && $this->hasParent()) {
            $parentConfig = $this->getParent()->getConfiguration();
            $parentResourceName = $parentConfig->getResourceName();
            //$parentResourceNamePlural = $parentConfig->getResourceName(true);
            $parent = $context->getResource($parentResourceName);

            /** @var \Doctrine\ORM\Mapping\ClassMetadataInfo $metadata */
            $metadata = $this->get($this->config->getServiceKey('metadata'));

            // Look for many to one
            if ($metadata->hasAssociation($parentResourceName)) {
                $mapping = $metadata->getAssociationMapping($parentResourceName);
                if ($mapping['type'] === ClassMetadataInfo::MANY_TO_ONE) {
                    try {
                        $propertyAccessor = PropertyAccess::createPropertyAccessor();
                        $propertyAccessor->setValue($resource, $parentResourceName, $parent);
                    } catch (\Exception $e) {
                        throw new \RuntimeException('Failed to set resource\'s parent.');
                    }
                } else {
                    throw new \RuntimeException(sprintf('"%s" is not a supported association type.', $parentResourceName));
                }
                // Look for many to many
            } /*elseif ($metadata->hasAssociation($parentResourceNamePlural)) {
                $mapping = $metadata->getAssociationMapping($parentResourceNamePlural);
                if ($mapping['type'] === ClassMetadataInfo::MANY_TO_MANY) {
                    try {
                        call_user_func(array($resource, 'add'.ucfirst($parentResourceName)), $parent);
                    } catch (\Exception $e) {
                        throw new \RuntimeException('Failed to associate resource with his parent.');
                    }
                } else {
                    throw new \RuntimeException(sprintf('"%s" is not a supported association type.', $parentResourceNamePlural));
                }
            }*/ else {
                throw new \RuntimeException(sprintf('Association "%s" not found.', $parentResourceName));
            }
        }

        return $resource;
    }