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
|
@@ 248-263 (lines=16) @@
|
| 245 |
|
* |
| 246 |
|
* @throws NotFoundHttpException If Page doesn't exist |
| 247 |
|
*/ |
| 248 |
|
private function getPageById($id, $expectedVersion = null) |
| 249 |
|
{ |
| 250 |
|
if ($expectedVersion) { |
| 251 |
|
$page = $this->getEntityManager()->getRepository('Webcook\Cms\CoreBundle\Entity\Page')->find($id, LockMode::OPTIMISTIC, $expectedVersion); |
| 252 |
|
} else { |
| 253 |
|
$page = $this->getEntityManager()->getRepository('Webcook\Cms\CoreBundle\Entity\Page')->find($id); |
| 254 |
|
} |
| 255 |
|
|
| 256 |
|
if (!$page instanceof Page) { |
| 257 |
|
throw new NotFoundHttpException('Page not found.'); |
| 258 |
|
} |
| 259 |
|
|
| 260 |
|
$this->saveLockVersion($page); |
| 261 |
|
|
| 262 |
|
return $page; |
| 263 |
|
} |
| 264 |
|
} |
| 265 |
|
|