Newscoop\Entity\Comment::setRecommended PHP Метод

setRecommended() публичный Метод

Set recommended
public setRecommended ( string $recommended ) : Newscoop\Entity\Comment
$recommended string
Результат Newscoop\Entity\Comment
    public function setRecommended($recommended)
    {
        if ($recommended) {
            $this->recommended = 1;
        } else {
            $this->recommended = 0;
        }
        return $this;
    }

Usage Example

Пример #1
0
 /**
  * Method for update a comment
  *
  * @param Comment $entity
  * @param array   $values
  *
  * @return Comment $enitity
  */
 public function update(Comment $comment, $values)
 {
     // get the enitity manager
     $em = $this->getEntityManager();
     if (array_key_exists('subject', $values) && !is_null($values['subject'])) {
         $comment->setSubject($values['subject']);
     }
     if (array_key_exists('message', $values) && !is_null($values['message'])) {
         $comment->setMessage($values['message']);
     }
     if (array_key_exists('recommended', $values) && !is_null($values['recommended'])) {
         $comment->setRecommended($values['recommended']);
     }
     if (array_key_exists('status', $values) && !is_null($values['status'])) {
         $comment->setStatus($values['status']);
     }
     $comment->setTimeUpdated(new \DateTime());
     return $comment;
 }
All Usage Examples Of Newscoop\Entity\Comment::setRecommended