Symfony1 Admin Generator
Format generator.yml
●

●

By default, the columns of the list view are the columns defined in
schema.yml.
The fields of the new and edit views...
fields:
status: { name: Is Active}
currency_id_pair: {name: Currency Pair ID}
campaign_point: {name: My Header}

View :
This is a general principle:
Any settings that are set for the whole module under the
fields key, can be overridden by vie...
Setting a Custom Title, Content/Layout of view.
edit:
title: Edit Article %%currency_pair%% (%%campaign_currency_values_id...
layout: stacked
params: |
%%=content%%<br />
(sent by %%author%% on %%created_at%% about %%article_link%%)
Setting a Default Sort Field in the list View
list:
sort:

created_at

## Alternative syntax, to specify a sort order
sort...
●

Using a Join to Speed Up Page Delivery
1.By default, the administration generator uses a simple
doSelect() to retrieve ...
Defining Interactions for Each View,
object_actions:
_edit:
_delete:

~
~

addcomment:

{ label: Add a comment, action: ad...
●

Clicking it triggers a call to the addComment action in the
current module.

Ex:
http://xyz/admin_dev.php/abc/addCommen...
Questions
Symfony Admin Generator - generator.yml
Symfony Admin Generator - generator.yml
Upcoming SlideShare
Loading in …5
×

Symfony Admin Generator - generator.yml

1,309 views
1,210 views

Published on

Tells most of the options that are available in symfony admin generator, generator.yml file, That makes the admin panel creation easy

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,309
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Symfony Admin Generator - generator.yml

  1. 1. Symfony1 Admin Generator
  2. 2. Format generator.yml
  3. 3. ● ● By default, the columns of the list view are the columns defined in schema.yml. The fields of the new and edit views are the one defined in the form associated with the model. With generator.yml, you can choose which fields are displayed (display: []), add fields of your own Ex: //Column followed with ( “_”) will display the partial template, usually a file like _currency_pair.php . display: [_currencyPair, ...] //Column followed with ( “=”) will display the column with anchor link (<a />) to edit the particular record. display: [=currencyPair, ...] display: [~article_link, …] //Like class file, we have some thing like components.class.php file, will include that. (You may need to split a partial into a logic part and a presentation part. In such a case, you should use a component).
  4. 4. fields: status: { name: Is Active} currency_id_pair: {name: Currency Pair ID} campaign_point: {name: My Header} View :
  5. 5. This is a general principle: Any settings that are set for the whole module under the fields key, can be overridden by view-specific areas. The overriding rules are the following: ● new and edit inherits from form which inherits from fields ● list inherits from fields ● filter inherits from fields
  6. 6. Setting a Custom Title, Content/Layout of view. edit: title: Edit Article %%currency_pair%% (%%campaign_currency_values_id%%) Output: http://xyz/admin_dev.php/abc/edit/campaign_currency_values_id/26
  7. 7. layout: stacked params: | %%=content%%<br /> (sent by %%author%% on %%created_at%% about %%article_link%%)
  8. 8. Setting a Default Sort Field in the list View list: sort: created_at ## Alternative syntax, to specify a sort order sort: [created_at, desc] Customizing the Pagination: config: list: max_per_page: 5
  9. 9. ● Using a Join to Speed Up Page Delivery 1.By default, the administration generator uses a simple doSelect() to retrieve a list of records. 2. But, if you use related objects in the list, the number of database queries required to display the list may rapidly increase. Ex: If you want to display the name of the article in a list of comments, an additional query is required for each post in the list to retrieve the related Article object ● So you may want to force the pager to use a doSelectJoinXXX() method to optimize the number of queries. config: list: peer_method: doSelectJoinArticle
  10. 10. Defining Interactions for Each View, object_actions: _edit: _delete: ~ ~ addcomment: { label: Add a comment, action: addComment }
  11. 11. ● Clicking it triggers a call to the addComment action in the current module. Ex: http://xyz/admin_dev.php/abc/addComment/campaign_currency_valu So need to implement the code : public function executeAddComment($request) { $comment = new Comment(); $comment->setArticleId($request->getParameter('id')); $comment->save(); $this->redirect('comments_edit', $comment); }
  12. 12. Questions

×