_compiledRoute)) { $this->compile(); } if (isset($url['_entity'])) { $entity = $url['_entity']; $this->_checkEntity($entity); foreach ($this->keys as $field) { if (!isset($url[$field]) && isset($entity[$field])) { $url[$field] = $entity[$field]; } } } return parent::match($url, $context); } /** * Checks that we really deal with an entity object * * @throws \RuntimeException * @param \ArrayAccess|array $entity Entity value from the URL options * @return void */ protected function _checkEntity($entity) { if (!$entity instanceof ArrayAccess && !is_array($entity)) { throw new RuntimeException(sprintf( 'Route `%s` expects the URL option `_entity` to be an array or object implementing \ArrayAccess, but `%s` passed.', $this->template, getTypeName($entity) )); } } }