Skip to content

Commit

Permalink
Merge pull request #5 from locomotivemtl/locale-from-host
Browse files Browse the repository at this point in the history
Define language in GenericRoute's ObjectRoute query
  • Loading branch information
dominiclord authored Oct 17, 2017
2 parents 5641a7e + dce4dc5 commit 6043e45
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Charcoal/Cms/Route/GenericRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,11 @@ protected function loadObjectRouteFromPath()
// Slug can be duplicated by adding the front "/" to it hence the order by last_modification_date
$route = $this->createRouteObject();
$route->loadFromQuery(
'SELECT * FROM `'.$route->source()->table().'` WHERE (`slug` = :route1 OR `slug` = :route2) ORDER BY last_modification_date DESC LIMIT 1',
'SELECT * FROM `'.$route->source()->table().'` WHERE (`slug` = :route1 OR `slug` = :route2) AND `lang` = :lang ORDER BY last_modification_date DESC LIMIT 1',
[
'route1' => '/'.$this->path(),
'route2' => $this->path()
'route2' => $this->path(),
'lang' => $this->translator()->getLocale()
]
);

Expand Down

0 comments on commit 6043e45

Please sign in to comment.