Skip to content

Commit

Permalink
improve two listeners, fix issues after last merging
Browse files Browse the repository at this point in the history
  • Loading branch information
ahilles107 committed Nov 5, 2014
1 parent 3199e2c commit 18f7ce6
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 14 deletions.
3 changes: 1 addition & 2 deletions newscoop/application/configs/symfony/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ fos_rest:
default_format: ~
view:
default_engine: twig
view_response_listener: force
view_response_listener: true
failed_validation: HTTP_BAD_REQUEST
formats:
json: true
xml: true
mime_types:
json: ['application/json', 'application/x-json', 'application/vnd.example-com.foo+json']
body_listener:
Expand Down
2 changes: 1 addition & 1 deletion newscoop/classes/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public function __create($p_values = null) { return parent::create($p_values); }
* @param int $p_sectionNumber
* @return void
*/
public function create($p_articleType, $p_name = null, $p_publicationId = null, $p_issueNumber = null, $p_sectionNumber = null)
public function create($p_articleType = null, $p_name = null, $p_publicationId = null, $p_issueNumber = null, $p_sectionNumber = null)
{
global $g_ado_db;

Expand Down
2 changes: 1 addition & 1 deletion newscoop/classes/ArticleTypeField.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function getFilter()
* @param string $p_type
* Can be one of: 'text', 'date', 'body', 'switch', 'numeric'.
*/
public function create($p_type, array $p_params = array())
public function create($p_type = null, array $p_params = array())
{
global $g_ado_db;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function getArticle($number, $language = null)

$queryBuilder = $em->getRepository('Newscoop\Entity\Article')
->createQueryBuilder('a')
->select('a', 'p', 'i', 's.name', 'l.code')
->select('a', 'p', 'i', 's', 'l')
->leftJoin('a.packages', 'p')
->leftJoin('a.issue', 'i')
->leftJoin('a.section', 's')
Expand All @@ -107,7 +107,6 @@ public function getArticle($number, $language = null)
->setParameter('number', $number);

if (!is_null($language)) {

if (!is_numeric($language)) {
$queryBuilder->andWhere('l.code = :code')
->setParameter('code', $language);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ public function getAllTypes()
->from('\Newscoop\Entity\ArticleType', 'at' )
->where("at.fieldName IS NULL OR at.fieldName = 'NULL'" );

return $qb->getQuery();
$countQueryBuilder = clone $qb;
$countQueryBuilder->select('COUNT(at)');

$count = $countQueryBuilder->getQuery()->getSingleScalarResult();

$query = $qb->getQuery();
$query->setHint('knp_paginator.count', $count);

return $query;
}
}
2 changes: 1 addition & 1 deletion newscoop/library/Newscoop/Services/TemplatesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TemplatesService
*/
protected $themesService;

public function __construct(ThemesServiceInterface $themesService)
public function __construct(ThemesService $themesService)
{
$this->smarty = \CampTemplate::singleton();
$this->smarty->assign('gimme', $this->smarty->context());
Expand Down
Empty file modified newscoop/log/newscoop-audit.log
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ public function onRequest(GetResponseEvent $event)
{
$request = $event->getRequest();
$route = $request->attributes->get('_route');
if (strpos($route, 'newscoop_gimme_') === false) {
return;
}

// todo add caching here
$unprotected = $this->em->getRepository('\Newscoop\GimmeBundle\Entity\PublicApiResource')->findOneByResource($route);
$rootsArray = array(
'newscoop_gimme_users_login',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ Newscoop\Entity\Article:
type: DateTime
groups: ["list", "details"]
serialized_name: published
uploaded:
expose: true
read_only: true
type: DateTime
groups: ["list", "details"]
serialized_name: created
since_version: 1.2
articleAuthors:
expose: true
read_only: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ public function __construct(IssueService $issueService)
*/
public function onRequest(GetResponseEvent $event)
{
$pos = strpos($event->getRequest()->getRequestUri(), '/admin');
if ($pos === false) {
$this->issueService->issueResolver($event->getRequest());
}
$this->issueService->issueResolver($event->getRequest());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function onRequest(GetResponseEvent $event)
$extension = $locale.'.yml';
$files = array();

$finder->files()->in(__DIR__.'/../../../../plugins');
$finder->files()->in(__DIR__.'/../../../../plugins/*/admin-files/translations');
$finder->files()->name('*.'.$locale.'.yml');

foreach ($finder as $file) {
Expand Down

0 comments on commit 18f7ce6

Please sign in to comment.