-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version upgrades and cleanups #58
Changes from 9 commits
6666e4b
0dd64f5
18747ee
899e53e
5c11169
ac7955a
948cb7c
59aec76
2d12503
623798d
def6d54
2e85bfe
289b616
a3d9792
bdc0f0e
8e82d64
ab1fc9c
6425ce0
db62834
27bb8a4
dde14b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
Tests/Resources/app/cache | ||
Tests/Resources/app/logs | ||
Tests/Resources/test_db.sqlite | ||
bin/ | ||
composer.lock | ||
vendor | ||
vendor/ | ||
.idea | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the responsibility of the global git configuration of the developer, it is not specific to the project but to specific development environments. please remove this line. |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony CMF package. | ||
* | ||
* (c) 2011-2014 Symfony CMF | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra line |
||
namespace Symfony\Cmf\Bundle\BlogBundle\Controller; | ||
|
||
use Knp\Component\Pager\Paginator; | ||
use Symfony\Cmf\Bundle\BlogBundle\Model\Post; | ||
use Symfony\Cmf\Bundle\BlogBundle\Model\Blog; | ||
use Symfony\Cmf\Bundle\BlogBundle\Repository\PostRepository; | ||
use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishWorkflowChecker; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||
use Symfony\Component\Security\Core\SecurityContextInterface; | ||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; | ||
use FOS\RestBundle\View\ViewHandlerInterface; | ||
use FOS\RestBundle\View\View; | ||
|
||
/** | ||
* Base Controller | ||
* | ||
* @author Daniel Leech <[email protected]> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't write this :) |
||
*/ | ||
abstract class BaseController | ||
{ | ||
/** | ||
* @var EngineInterface | ||
*/ | ||
protected $templating; | ||
|
||
/** | ||
* @var SecurityContextInterface | ||
*/ | ||
protected $securityContext; | ||
|
||
/** | ||
* @var ViewHandlerInterface | ||
*/ | ||
protected $viewHandler; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param EngineInterface $templating | ||
* @param SecurityContextInterface $securityContext | ||
* @param ViewHandlerInterface $viewHandler | ||
*/ | ||
public function __construct( | ||
EngineInterface $templating, | ||
SecurityContextInterface $securityContext, | ||
ViewHandlerInterface $viewHandler = null | ||
) { | ||
$this->templating = $templating; | ||
$this->securityContext = $securityContext; | ||
$this->viewHandler = $viewHandler; | ||
} | ||
|
||
protected function renderResponse($contentTemplate, $params) | ||
{ | ||
if ($this->viewHandler) { | ||
$view = new View($params); | ||
$view->setTemplate($contentTemplate); | ||
return $this->viewHandler->handle($view); | ||
} | ||
|
||
return $this->templating->renderResponse($contentTemplate, $params); | ||
} | ||
|
||
protected function getTemplateForResponse(Request $request, $contentTemplate) | ||
{ | ||
return str_replace( | ||
array('{_format}', '{_locale}'), | ||
array($request->getRequestFormat(), $request->getLocale()), | ||
$contentTemplate | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also put this in
app/cache