Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Conversation

atwixfirster
Copy link
Contributor

@atwixfirster atwixfirster commented May 16, 2019

Purpose of this pull request

This pull request (PR) adds information about action result objects.

Affected DevDocs pages

Links to Magento source code

Thank you!

whatsnew
Added reference documentation about the result object returned by the Action class

@devops-devdocs
Copy link
Collaborator

An admin must run tests on this PR before it can be merged.

@ronak2ram ronak2ram self-requested a review May 16, 2019 15:56
@ronak2ram ronak2ram self-assigned this May 16, 2019
Merge remote-tracking branch 'upstream/master' into routing-result-object

# Conflicts:
#	guides/v2.1/extension-dev-guide/routing.md
#	guides/v2.3/extension-dev-guide/routing.md
@jeff-matthews jeff-matthews added 2.1.x 2.2.x 2.3.x Magento 2.3 related changes Major Update Significant original updates to existing content labels May 17, 2019
@erikmarr erikmarr self-requested a review May 17, 2019 15:06
Copy link
Contributor

@erikmarr erikmarr left a comment

Choose a reason for hiding this comment

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

@atwixfirster this looks really good. I only have some minor editorial feedback.


Name | Description
--- | ---
`json` | Sets `Content-Type:application/json` in the header and returns a json encoded representation of an array with data.
Copy link
Contributor

Choose a reason for hiding this comment

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

remove ending period

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Name | Description
--- | ---
`json` | Sets `Content-Type:application/json` in the header and returns a json encoded representation of an array with data.
`raw` | Returns the data as it's been set. Does not set a `Content-Type` of the header.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
`raw` | Returns the data as it's been set. Does not set a `Content-Type` of the header.
`raw` | Returns the data as it's been set. Does not set a `Content-Type` in the header.

Also, remove period from end of last sentence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

--- | ---
`json` | Sets `Content-Type:application/json` in the header and returns a json encoded representation of an array with data.
`raw` | Returns the data as it's been set. Does not set a `Content-Type` of the header.
`redirect` | Creates an external redirect, which the browser follows and requests a new url.
Copy link
Contributor

Choose a reason for hiding this comment

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

remove period from end of sentence

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

`json` | Sets `Content-Type:application/json` in the header and returns a json encoded representation of an array with data.
`raw` | Returns the data as it's been set. Does not set a `Content-Type` of the header.
`redirect` | Creates an external redirect, which the browser follows and requests a new url.
`forward` | Internally calls the execute method of another action class and does not trigger a new request from the browser. The URL stays the same.
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove period from end of last sentence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

`raw` | Returns the data as it's been set. Does not set a `Content-Type` of the header.
`redirect` | Creates an external redirect, which the browser follows and requests a new url.
`forward` | Internally calls the execute method of another action class and does not trigger a new request from the browser. The URL stays the same.
`layout` | View result. A generic layout response can be used for rendering any kind of layout. So it comprises a response body from the layout elements it has and sets it to the HTTP response
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
`layout` | View result. A generic layout response can be used for rendering any kind of layout. So it comprises a response body from the layout elements it has and sets it to the HTTP response
`layout` | View result. You can use a generic layout response to render any kind of layout. The layout comprises a response body from its layout elements and sets it to the HTTP response

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Name | Description
--- | ---
`json` | Sets `Content-Type:application/json` in the header and returns a json encoded representation of an array with data.
`raw` | Returns the data as it's been set. Does not set a `Content-Type` of the header!
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove ending exclamation mark

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@erikmarr , could you please review?

Thank you!

{: .bs-callout .bs-callout-info }
Action class should return a `result object`.

## Result object
Copy link
Contributor

Choose a reason for hiding this comment

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

Please apply above edits to this table as well except where noted below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

`redirect` | Creates an external redirect, which the browser follows and requests a new url.
`forward` | Internally calls the execute method of another action class and does not trigger a new request from the browser. The URL stays the same.
`layout` | View result. A generic layout response can be used for rendering any kind of layout. So it comprises a response body from the layout elements it has and sets it to the HTTP response
`page` | View result. Encapsulates page type, page configuration and imposes certain layout handles. Triggers `layout.xml` rendering into HTML.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
`page` | View result. Encapsulates page type, page configuration and imposes certain layout handles. Triggers `layout.xml` rendering into HTML.
`page` | View result. Encapsulates page type, page configuration, and imposes certain layout handles. `page` triggers `layout.xml` to render into HTML

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@erikmarr erikmarr left a comment

Choose a reason for hiding this comment

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

Looks good!

@erikmarr
Copy link
Contributor

running tests

@erikmarr erikmarr merged commit 17ef4c3 into magento:master May 20, 2019
@ghost
Copy link

ghost commented May 20, 2019

Hi @atwixfirster, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@erikmarr
Copy link
Contributor

Thanks @atwixfirster!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2.1.x 2.2.x 2.3.x Magento 2.3 related changes Major Update Significant original updates to existing content Partner: Atwix partners-contribution PR created by Magento partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants