setStatus() public method

public setStatus ( string $status )
$status string
示例#1
0
 /**
  * Transition a record's status if permitted.
  *
  * @param Content $entity
  * @param string  $newStatus
  */
 protected function transistionRecordStatus(Content $entity, $newStatus)
 {
     $contentTypeName = (string) $entity->getContenttype();
     $canTransition = $this->users->isContentStatusTransitionAllowed($entity->getStatus(), $newStatus, $contentTypeName, $entity->getId());
     if (!$canTransition) {
         $this->loggerFlash->error(Trans::__('general.access-denied.content-not-modified', ['%title%' => $entity->getTitle()]));
         return;
     }
     $entity->setStatus($newStatus);
     $entity->_modified = true;
 }