src/SlugHandler.php
protected function findSlug()
    {
        /** @var SilverStripe\Control\Controller */
        $owner = $this->getOwner();
        $request = $owner->getRequest();
        
        // You're probably wondering about these variable names...
        $plot = $this->dataSource;
        $garden = $owner->$plot();
        if (!$garden) {
            $mrMcGregors = get_class($owner);
            throw new LogicException("There is no garden in $mrMcGregors::$plot() to find Slugs in!");
        }
        $slime = $this->slugs;
        if (!$slime) {
            $slime = $garden->config()->get('slug_trails') ?: $owner->config()->get('slug_trails');
        }
        $trail = $request->param('Trail') ?: '';
        $slimeTrail = array_key_exists($trail, $slime) ? $slime[$trail] : $owner->httpError(404);
        $slug = $request->param('Slug');
        // ...I follow slime trails in the garden to find slugs :)
        return $garden->$slimeTrail()->find('URLSlug', $slug);
    }
protected function findSlug()
    {
        /** @var SilverStripe\Control\Controller */
        $owner = $this->getOwner();
        $request = $owner->getRequest();
        
        // You're probably wondering about these variable names...
        $plot = $this->dataSource;
        $garden = $owner->$plot();
        if (!$garden) {
            $mrMcGregors = get_class($owner);
            throw new LogicException("There is no garden in $mrMcGregors::$plot() to find Slugs in!");
        }
        $slime = $this->slugs;
        if (!$slime) {
            $slime = $garden->config()->get('slug_trails') ?: $owner->config()->get('slug_trails');
        }
        $trail = $request->param('Trail') ?: '';
        $slimeTrail = array_key_exists($trail, $slime) ? $slime[$trail] : $owner->httpError(404);
        $slug = $request->param('Slug');
        // ...I follow slime trails in the garden to find slugs :)
        return $garden->$slimeTrail()->find('URLSlug', $slug);
    }
Fetches the slugged item at the end of a route (slime trail).

@return DataObject
@throws LogicException
@throws HTTPResponse_Exception 404