Php 如何配置Symfony工作流

Php 如何配置Symfony工作流,php,symfony,workflow,symfony4,Php,Symfony,Workflow,Symfony4,我使用Symfony 4.2版本 我做了一个工作流服务,他有三个地方起草、审阅和发布 我将这几行代码添加到conf/products/framework.yaml中。但我不明白代码中的当前位置是什么。我用这个例子工作 但是当我刷新站点时,我得到了这个错误 Warning: array_map(): Argument #2 should be an array YAML配置的places部分无效 应该是这样的: places: - draft - reviewed

我使用Symfony 4.2版本 我做了一个工作流服务,他有三个地方起草、审阅和发布

我将这几行代码添加到conf/products/framework.yaml中。但我不明白代码中的当前位置是什么。我用这个例子工作

但是当我刷新站点时,我得到了这个错误

   Warning: array_map(): Argument #2 should be an array

YAML配置的
places
部分无效

应该是这样的:

places:
    - draft
    - reviewed
    - published

请注意减号和项目名称之间的空格

我对其进行了更改,以便从类型中删除引号,删除参数,并添加了经\u管理员批准的\u,现在它可以工作了

framework:
  workflows:
    article_publishing:
      type: workflow
      audit_trail: true
      marking_store:
        type: multiple_state
      supports:
        - App\Entity\Article
      places:
        - draft
        - for_review
        - approved_by_admin
        - published
      transitions:
        to_for_review:
          from: draft
          to:   for_review
        to_approved_by_admin:
          from: for_review
          to: approved_by_admin
        to_published:
          from: approved_by_admin
          to:   published
        to_draft:
          from: for_review
          to:   draft
我把这个代码添加到控制器中

/**
     * @Route("/apply-transition/{article}", methods={"POST"})
     */
    public function applyTransition(WorkflowInterface $articleWorkflow, Request $request, Article $article, RouterInterface $router)
    {
        $slug = $article->getCategory()->getSlug();
        try {
            $articleWorkflow->apply($article, $request->request->get('transition'));
            $this->repository->flush();
        } catch (ExceptionInterface $e) {
           echo $e->getMessage();
        }
        $url = $router->generate('app_category_view', ([
            'slug' => $slug,
        ]));
        return new RedirectResponse($url);

    }
    /**
     * @Route("/resetMarking/{article}", methods={"POST"})
     */

    public function resetMarking(Article $article, RouterInterface $router)
    {
        $slug = $article->getCategory()->getSlug();
        $article->setMarking([]);
        $this->repository->flush();
        $url = $router->generate('app_category_view', ([
            'slug' => $slug,
        ]));
        return new RedirectResponse($url);
    }
我在实体中加上这个

/**
     * @ORM\Column(type="json_array", nullable=true)
     */
    private $marking;

    /**
     * @ORM\Column(type="json_array", nullable=true)
     */
    private $transitionContexts;

您能显示更多异常的堆栈跟踪吗?@sensorario我现在添加一个错误的屏幕截图
/**
     * @ORM\Column(type="json_array", nullable=true)
     */
    private $marking;

    /**
     * @ORM\Column(type="json_array", nullable=true)
     */
    private $transitionContexts;