src/Controller/ArticleController.php
public function UpdateAction()
  {
    // Gets the article id, then stores it
    $id = $_GET['id'];

    // Checks if the form has been completed
    if (!empty($_POST))
    {
      // Checks if a new file has been uploaded
      if (!empty($_FILES['file']['name']))
      {
        // Uploads the image, then gets back the file name
        $data['image'] = $this->upload('img/blog');
      }
      // Retrieves form data & stores them
      $data['title']        = $_POST['title'];
      $data['link']         = $_POST['link'];
      $data['content']      = $_POST['content'];
      $data['updated_date'] = $_POST['date'];

      // Updates the article
      ModelFactory::get('Article')->update($id, $data);

      // Creates an info message to confirm the update of the selected article
      htmlspecialchars(Session::createAlert('Successful modification of the selected article !', 'info'));

      // Redirects to the admin
      $this->redirect('admin');
    }
    // Reads the article, then store it
    $article = ModelFactory::get('Article')->read($id);

    // Returns the rendering of the view updateArticle with the current article
    return $this->render('admin/blog/updateArticle.twig', ['article' => $article]);
  }
public function UpdateAction()
  {
    // Gets the article id, then stores it
    $id = $_GET['id'];

    // Checks if the form has been completed
    if (!empty($_POST))
    {
      // Checks if a new file has been uploaded
      if (!empty($_FILES['file']['name']))
      {
        // Uploads the image, then gets back the file name
        $data['image'] = $this->upload('img/blog');
      }
      // Retrieves form data & stores them
      $data['title']        = $_POST['title'];
      $data['link']         = $_POST['link'];
      $data['content']      = $_POST['content'];
      $data['updated_date'] = $_POST['date'];

      // Updates the article
      ModelFactory::get('Article')->update($id, $data);

      // Creates an info message to confirm the update of the selected article
      htmlspecialchars(Session::createAlert('Successful modification of the selected article !', 'info'));

      // Redirects to the admin
      $this->redirect('admin');
    }
    // Reads the article, then store it
    $article = ModelFactory::get('Article')->read($id);

    // Returns the rendering of the view updateArticle with the current article
    return $this->render('admin/blog/updateArticle.twig', ['article' => $article]);
  }
****************\
Updates an article
@return mixed => the rendering of the view updateArticle