Skip to content

[FrameworkBundle] adds routing/container descriptors #7887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from

Conversation

jfsimon
Copy link
Contributor

@jfsimon jfsimon commented Apr 30, 2013

The goal of this PR is to add descriptors (as in #7454) for routing and container. This will permit add a --format option to router:debug and container:debug commands (with txt, json, xml and md formats).

@jfsimon
Copy link
Contributor Author

jfsimon commented Jun 4, 2013

@fabpot this PR is finally completed. Could you please check various output formats? They can be found in tests fixtures: https://github.com/jfsimon/symfony/tree/feat-framework-descriptors/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor.

}
}

$tags = $definition->getTags();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, thanks.

@deguif
Copy link
Contributor

deguif commented Sep 26, 2013

Will this be available in 2.4 ?

<default attribute="name">Joseph</default>
</defaults>
<requirements>
<requirement attribute="compiler_class">Symfony\Component\Routing\RouteCompiler</requirement>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the requirements for xml look wrong. these are options not requirements.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooops, thanks you! fixed now

<method>GET</method>
<method>HEAD</method>
<defaults>
<default attribute="name">Joseph</default>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of "attribute" I would name this "name". so <default name="...">

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

option tag already uses a name attribute, I guess it would be more consistent.

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<routes>
<route name="route_1" path="/hello/{name}" class="Symfony\Component\Routing\Route" path_regex="#^/hello(?:/(?P&lt;name&gt;[a-z]+))?$#s">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's missing the host regex

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it as attribute of the <host> tag, as the host regex existence depends on the host parameter existence.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k, but then I would also make "path" an element. otherwise its pretty inconsistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the path is mandatory, I though it would good to keep it as attribute.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attributes in xml are usually used for metadata (like the "class" that you have). but since the path is key info of a route it should be an element. see http://www.w3schools.com/dtd/dtd_el_vs_attr.asp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK thanks for the tip, I send a PR as soon as possible.

@fabpot fabpot closed this in 31fb8c7 Oct 1, 2013
fabpot added a commit that referenced this pull request Oct 2, 2013
…bug commands (fabpot)

This PR was merged into the master branch.

Discussion
----------

[WIP] [FrameworkBundle] fixed container:debug and router:debug commands

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

#7887 is buggy as hell :(

Commits
-------

fe5961a [FrameworkBundle] moved router:debug and container:debug to use the compact layout
bd16157 [FrameworkBundle] changed JSON descriptors to be more readable on PHP 5.4+
1d210f8 [FrameworkBundle] changed the router:debug to use the shortcut notation for the controller
d997dfa [FrameworkBundle] fixed container:debug and router:debug commands
fabpot added a commit that referenced this pull request Oct 2, 2013
This PR was merged into the master branch.

Discussion
----------

[FrameworkBundle] updated XML route description

This PR turns

```xml
<route name="route_1" path="/hello/{name}" class="Symfony\Component\Routing\Route" path_regex="#^/hello(?:/(?P&lt;name&gt;[a-z]+))?$#s">
```

into

```xml
<route name="route_1" class="Symfony\Component\Routing\Route">
    <path regex="#^/hello(?:/(?P&lt;name&gt;[a-z]+))?$#s">/hello/{name}</path>
```

in XML routing description.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #7887
| License       | MIT
| Doc PR        | n/a

Commits
-------

7b99ede [FrameworkBundle] updated XML route description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants