1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of Webcook common bundle. |
5
|
|
|
* |
6
|
|
|
* See LICENSE file in the root of the bundle. Webcook |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Webcook\Cms\CoreBundle\Controller; |
10
|
|
|
|
11
|
|
|
use Webcook\Cms\CoreBundle\Base\BaseRestController; |
12
|
|
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
13
|
|
|
use Webcook\Cms\CoreBundle\Entity\MenuContentProviderSettings; |
14
|
|
|
use Webcook\Cms\CoreBundle\Form\Type\MenuContentProviderSettingsType; |
15
|
|
|
use Nelmio\ApiDocBundle\Annotation\ApiDoc; |
16
|
|
|
use Webcook\Cms\SecurityBundle\Authorization\Voter\WebcookCmsVoter; |
17
|
|
|
use FOS\RestBundle\Controller\Annotations\Get; |
18
|
|
|
use FOS\RestBundle\Controller\Annotations\Post; |
19
|
|
|
use FOS\RestBundle\Controller\Annotations\Put; |
20
|
|
|
use FOS\RestBundle\Controller\Annotations\Delete; |
21
|
|
|
use Doctrine\DBAL\LockMode; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Page controller. |
25
|
|
|
*/ |
26
|
|
|
class MenuContentProviderSettingsController extends BaseRestController |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* Get single settings for menu content provider. |
30
|
|
|
* |
31
|
|
|
* @param int $id Id of the desired settings. |
|
|
|
|
32
|
|
|
*/ |
33
|
|
|
public function getMenuSettingsAction($pageId = null, $sectionId = null) |
34
|
|
|
{ |
35
|
|
|
$settings = null; |
36
|
|
|
if (!is_null($pageId) && !is_null($sectionId)) { |
37
|
|
|
$page = $this->getEntityManager()->getRepository('Webcook\Cms\CoreBundle\Entity\Page')->find($pageId); |
38
|
|
|
$section = $this->getEntityManager()->getRepository('Webcook\Cms\CoreBundle\Entity\Section')->find($sectionId); |
39
|
|
|
|
40
|
|
|
$settings = $this->getEntityManager()->getRepository('Webcook\Cms\CoreBundle\Entity\MenuContentProviderSettings')->findOneBy(array( |
41
|
|
|
'page' => $page, |
42
|
2 |
|
'section' => $section |
43
|
|
|
)); |
44
|
2 |
|
} |
45
|
|
|
|
46
|
|
|
|
47
|
|
|
if (is_null($settings)) { |
48
|
|
|
$view = $this->getViewWithMessage(null, 404, 'Settings not found.'); |
|
|
|
|
49
|
|
|
} else { |
50
|
|
|
$view = $this->view($settings, 200); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
return $this->handleView($view); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.