src/Webcook/Cms/CoreBundle/Controller/MenuContentProviderSettingsController.php 1 location
|
@@ 192-207 (lines=16) @@
|
| 189 |
|
* |
| 190 |
|
* @throws NotFoundHttpException If settings object doesn't exist. |
| 191 |
|
*/ |
| 192 |
|
private function getSettingsById(int $id, int $expectedVersion = null) |
| 193 |
|
{ |
| 194 |
|
if ($expectedVersion) { |
| 195 |
|
$settings = $this->getEntityManager()->getRepository('Webcook\Cms\CoreBundle\Entity\MenuContentProviderSettings')->find($id, LockMode::OPTIMISTIC, $expectedVersion); |
| 196 |
|
} else { |
| 197 |
|
$settings = $this->getEntityManager()->getRepository('Webcook\Cms\CoreBundle\Entity\MenuContentProviderSettings')->find($id); |
| 198 |
|
} |
| 199 |
|
|
| 200 |
|
if (!$settings instanceof MenuContentProviderSettings) { |
| 201 |
|
throw new NotFoundHttpException('Settings not found.'); |
| 202 |
|
} |
| 203 |
|
|
| 204 |
|
$this->saveLockVersion($settings); |
| 205 |
|
|
| 206 |
|
return $settings; |
| 207 |
|
} |
| 208 |
|
} |
| 209 |
|
|
src/Webcook/Cms/CoreBundle/Tests/Helpers/Controller/TestController.php 1 location
|
@@ 105-120 (lines=16) @@
|
| 102 |
|
* |
| 103 |
|
* @return TestEntity [description] |
| 104 |
|
*/ |
| 105 |
|
public function getTestEntityById($id, $expectedVersion = null) |
| 106 |
|
{ |
| 107 |
|
if ($expectedVersion) { |
| 108 |
|
$testEntity = $this->getEntityManager()->getRepository('Webcook\Cms\CoreBundle\Entity\TestEntity')->find($id, LockMode::OPTIMISTIC, $expectedVersion); |
| 109 |
|
} else { |
| 110 |
|
$testEntity = $this->getEntityManager()->getRepository('Webcook\Cms\CoreBundle\Entity\TestEntity')->find($id); |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
if (!$testEntity instanceof TestEntity) { |
| 114 |
|
throw new NotFoundHttpException('TestEntity not found.'); |
| 115 |
|
} |
| 116 |
|
|
| 117 |
|
$this->saveLockVersion($testEntity); |
| 118 |
|
|
| 119 |
|
return $testEntity; |
| 120 |
|
} |
| 121 |
|
} |
| 122 |
|
|
src/Webcook/Cms/CoreBundle/Controller/PageController.php 1 location
|
@@ 80-95 (lines=16) @@
|
| 77 |
|
* |
| 78 |
|
* @throws NotFoundHttpException If Page doesn't exist |
| 79 |
|
*/ |
| 80 |
|
private function getPageById($id, $expectedVersion = null) |
| 81 |
|
{ |
| 82 |
|
if ($expectedVersion) { |
| 83 |
|
$page = $this->getEntityManager()->getRepository('Webcook\Cms\CoreBundle\Entity\Page')->find($id, LockMode::OPTIMISTIC, $expectedVersion); |
| 84 |
|
} else { |
| 85 |
|
$page = $this->getEntityManager()->getRepository('Webcook\Cms\CoreBundle\Entity\Page')->find($id); |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
if (!$page instanceof Page) { |
| 89 |
|
throw new NotFoundHttpException('Page not found.'); |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
$this->saveLockVersion($page); |
| 93 |
|
|
| 94 |
|
return $page; |
| 95 |
|
} |
| 96 |
|
} |
| 97 |
|
|