Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Added documentation for the CmfResourceBundle #838

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Sep 3, 2017

Written in one straight, so probably contains lots of mistakes & typos :)

@wouterj wouterj force-pushed the resource-bundle-docs branch from 5f8a97a to 07fb92e Compare September 3, 2017 13:19
Copy link
Member

@ElectricMaxxx ElectricMaxxx left a comment

Choose a reason for hiding this comment

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

Just some little hints or questions to make some stuff clearer. Thanks for you effort

==============================

The resources retrieved from the :doc:`resource repositories <repositories>`
can be enhanced with descriptions: Bits of information about the resource. This
Copy link
Member

Choose a reason for hiding this comment

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

For me that kind of naming "description" or "descriptors" was new on API or resources, So i would extend the explenation a little bit.

Copy link
Member

Choose a reason for hiding this comment

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

I mean there is some more on index, but for a direct visitor this would not be enough.

{
$homepageResource = $this->get('cmf_resource.repository.default')->get('/pages/homepage');

$descriptionFactory = $this->get('cmf_resource.description.factory');
Copy link
Member

Choose a reason for hiding this comment

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

why sould i retrieve description server side? Should i use them to change application output flow at the end?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, using them on the front-end in the tree is only one use-case (and even in this use-case, the description is retrieved in the back-end by the ResourceRestBundle).

But resource is waaaaay more usefull than just TreeBrowser. E.g. symfony-cmf/routing-bundle#314 , on the long run all other bundles will just use resources. The resource component then provides an ORM repository and all bundles have ORM support \o/.

Another example is rendering, imagine a controller passing only the resource and resource description to a template. The template can then render it's title, body and metadata (e.g. SeoBundle has an enhancer as well) without knowing the backend. This means we can easily swap the PHPCR repository for Puli's FilesystemRepository and have static-CMS like functionality.

Copy link
Member

Choose a reason for hiding this comment

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

You would render the attributes in your Twig template. There was also a twig helper somewhere... But you may also want to generate a JSON response.


:doc:`introduction`
Ships a ``sylius_resource`` enhancer, adding CRUD links for the SyliusResourceBundle_.

Copy link
Member

Choose a reason for hiding this comment

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

i also added a position enhancer to servie the position property inside SonataDoctrinePhpcrAdminBundle. I helps to keep sorting alive after d&d.

==============================

The resources retrieved from the :doc:`resource repositories <repositories>`
can be enhanced with descriptions: Bits of information about the resource. This
Copy link
Member

Choose a reason for hiding this comment

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

Bits of information => Standardized bits of information (for example URLs, thumbnails, titles, etc.) which can be consumed by disparate components or applications or similar?

Copy link
Member

@dantleech dantleech left a comment

Choose a reason for hiding this comment

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

👍 take or leave my comments, looks good as-is for me.

enhancers*. The :doc:`TreeBrowserBundle <../tree_browser/introduction>` for
instance ships with an enhancer to add paths to document icons. Read more
about adding your own description enhancers in :doc:`description_enhancers`.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe something on the idea behind this originally, here or in the relevant section


Description enhancers allow you (or a third-party) to provide descriptions, for example, you are developing a component which requires a title and thumbnail image to represent an entity (for example a browser). Your component may be used with either Sylius or Sonata Admin. Both of these applications are capable of providing the required metadata, but they do so in very ways.

Description enhancers enable you to abstract yourself away from these differences.

Copy link
Member

@dbu dbu left a comment

Choose a reason for hiding this comment

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

thanks a lot for writing this up wouter. can you check the build error (some target not existing) and maybe add the suggestions from dan and max? but lets merge this asap - a useful documentation that is online is better than perfect documentation that is not merged ;-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants