PHP code example of m-adamski / symfony-helpers-bundle
1. Go to this page and download the library: Download m-adamski/symfony-helpers-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
m-adamski / symfony-helpers-bundle example snippets
(php)
$this->notificationHelper->addNotification(
NotificationHelper::ERROR_TYPE,
$this->translator->trans("An error occurred while trying to create a entry", [], "blog")
);
(php)
public function index(Request $request, int $page) {
return $this->render("modules/News/index.html.twig", [
"page" => $page,
"news" => $this->paginationHelper->responseData($request, $this->newsRepository, $page)
]);
}
(php)
public function getPaginated(int $page = 1, int $limit = 20) {
$queryBuilder = $this->getEntityManager()->getRepository("App:News")
->createQueryBuilder("news");
$queryBuilder->where($queryBuilder->expr()->eq("news.public", true))
->orderBy("news.createdAt", "DESC");
return $this->paginate($queryBuilder->getQuery(), $page, $limit);
}