Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 63f7d65

Browse files
committed
First test passes, updating fails however
1 parent 8928354 commit 63f7d65

File tree

5 files changed

+22
-4
lines changed

5 files changed

+22
-4
lines changed

AutoRoute/Adapter/PhpcrOdmAdapter.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ public function translateObject($contentDocument, $locale)
5252
return $contentDocument;
5353
}
5454

55-
public function createRoute($path, $contentDocument)
55+
public function createRoute($url, $contentDocument)
5656
{
57+
$path = $this->getPathFromUrl($url);
5758
$pathElements = explode('/', $path);
5859
$headName = array_pop($pathElements);
5960
$parentPath = implode('/', $pathElements);
@@ -103,6 +104,12 @@ public function getReferringRoutes($contentDocument)
103104
*/
104105
public function findRouteForUrl($url)
105106
{
106-
return $this->dm->find(null, $this->baseRoutePath . $url);
107+
$path = $this->getPathFromUrl($url);
108+
return $this->dm->find(null, $path);
109+
}
110+
111+
private function getPathFromUrl($url)
112+
{
113+
return $this->baseRoutePath . $url;
107114
}
108115
}

AutoRoute/TokenProvider/AbstractTokenProvider.php

Whitespace-only changes.

Tests/Functional/EventListener/AutoRouteListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function testPersistBlog()
6060
public function provideTestUpdateBlog()
6161
{
6262
return array(
63-
array(false),
63+
// array(false),
6464
array(true),
6565
);
6666
}

Tests/Resources/Document/Post.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ public function getBlog()
6363
return $this->blog;
6464
}
6565

66+
public function getBlogTitle()
67+
{
68+
return $this->getBlog()->getTitle();
69+
}
70+
6671
public function getDate()
6772
{
6873
return $this->date;;
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Resources\Document\Blog:
2-
url_schema: /test/blog/{blog_title}
2+
url_schema: /blog/{blog_title}
33
token_providers:
44
blog_title: [content_method, { method: getTitle } ]
5+
6+
Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Resources\Document\Post:
7+
url_schema: /blog/{blog_title}/{post_title}
8+
token_providers:
9+
blog_title: [content_method, { method: getBlogTitle } ]
10+
post_title: [content_method, { method: getTitle } ]

0 commit comments

Comments
 (0)