/**
  * @param NodeInterface               $node
  * @param BlockNodePattern|Constraint $constraint
  */
 public function validate($node, Constraint $constraint)
 {
     if ($node->getStatus() instanceof StatusInterface && $node->getStatus()->isPublished()) {
         $areas = $node->getAreas();
         $routePattern = $node->getRoutePattern();
         foreach ($areas as $area) {
             $blocks = $area->getBlocks();
             foreach ($blocks as $block) {
                 $blockLabel = $block->getLabel();
                 $parameters = $this->generateFormManager->getRequiredUriParameter($block);
                 foreach ($parameters as $parameter) {
                     if (false === strpos($routePattern, '{' . $parameter . '}')) {
                         $this->context->buildViolation($constraint->message)->setParameters(array('%blockLabel%' => $blockLabel, '%parameter%' => $parameter))->atPath('routePattern')->addViolation();
                     }
                 }
             }
         }
     }
 }
 /**
  * @param NodeInterface $node
  *
  * @return array
  */
 protected function getStatusChoices(NodeInterface $node)
 {
     $choices = array();
     $transitions = $node->getStatus()->getFromRoles();
     foreach ($transitions as $transition) {
         $status = $transition->getToStatus();
         // Adding original status
         if (empty($choices)) {
             $choices[] = $transition->getFromStatus();
         }
         if ($this->authorizeStatusChangeManager->isGranted($node, $status)) {
             $choices[] = $status;
         }
     }
     return $choices;
 }
 /**
  * @param NodeInterface $node
  *
  * @return FacadeInterface
  */
 public function transformVersion($node)
 {
     $facade = $this->newFacade();
     $facade->id = $node->getId();
     $facade->nodeId = $node->getNodeId();
     $facade->name = $node->getName();
     $facade->version = $node->getVersion();
     $facade->createdBy = $node->getCreatedBy();
     $facade->updatedBy = $node->getUpdatedBy();
     $facade->createdAt = $node->getCreatedAt();
     $facade->updatedAt = $node->getUpdatedAt();
     $facade->status = $this->getTransformer('status')->transform($node->getStatus());
     return $facade;
 }