SlideShare uma empresa Scribd logo
1 de 5
View single data in Symfony 4
Vederea data.html.twig
{% extends 'base.html.twig' %}
{% block body %}
<table>
<tr>
<th>Nume</th>
<th>Culoare</th>
<th>Marime</th>
<th>Pret</th>
<th>Actions</th>
</tr>
{% for key in flowers %}
<tr>
<td>{{ key.nume }}</td>
<td>{{ key.culoare }}</td>
<td> {{ key.marime }}</td>
<td>{{ key.pret }}</td>
<td><a href="{{ app.request.baseUrl() }}/show/{{key.id}}">View</a></td>
</tr>
{% endfor %}
</table>
<a href="{{ app.request.baseUrl() }}/data/add">Insert a record</a>
{% endblock %}
Vederea data/show.html.twig
{% extends 'base.html.twig' %}
{% block body %}
<table>
<tr>
<th>Nume</th>
<th>Culoare</th>
<th>Marime</th>
<th>Pret</th>
</tr>
<tr>
<td>{{ flower.nume }}</td>
<td>{{ flower.culoare }}</td>
<td> {{ flower.marime }}</td>
<td>{{ flower.pret }}</td>
</tr>
</table>
<a href="{{ app.request.baseUrl() }}/data">Back</a>
{% endblock %}
Controller-ul DataController
<?php
namespace AppController;
use SymfonyComponentRoutingAnnotationRoute;
use SymfonyBundleFrameworkBundleControllerController;
use SymfonyComponentHttpFoundationRequest;
use AppEntityFlower;
use SymfonyComponentFormExtensionCoreTypeTextType;
use SymfonyComponentFormExtensionCoreTypeNumberType;
use SymfonyComponentFormExtensionCoreTypeSubmitType;
use SensioBundleFrameworkExtraBundleConfigurationMethod;
class DataController extends Controller
{
……………………………………………………….
…………………………………………………….
/**
* @Route("/show/{id}")
* @Method({"GET", "POST"})
*/
public function showAction($id)
{
$flower = $this->getDoctrine()-
>getRepository(Flower::class)->find($id);
return $this->render('data/show.html.twig',
array('flower' => $flower));
}

Mais conteúdo relacionado

Semelhante a 15. view single data

data insert in codeigniter.pptx
data insert in codeigniter.pptxdata insert in codeigniter.pptx
data insert in codeigniter.pptx
feesfesfesf
 
Ôn tập KTTMDT
Ôn tập KTTMDTÔn tập KTTMDT
Ôn tập KTTMDT
mrcoffee282
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)
club23
 

Semelhante a 15. view single data (17)

13. view data
13. view data13. view data
13. view data
 
vue-components.pdf
vue-components.pdfvue-components.pdf
vue-components.pdf
 
Lect# 1 html part ii
Lect# 1 html part iiLect# 1 html part ii
Lect# 1 html part ii
 
Creating web api and consuming part 2
Creating web api and consuming part 2Creating web api and consuming part 2
Creating web api and consuming part 2
 
Lab final
Lab finalLab final
Lab final
 
HTML Tables and Forms
HTML Tables and Forms HTML Tables and Forms
HTML Tables and Forms
 
data insert in codeigniter.pptx
data insert in codeigniter.pptxdata insert in codeigniter.pptx
data insert in codeigniter.pptx
 
Ôn tập KTTMDT
Ôn tập KTTMDTÔn tập KTTMDT
Ôn tập KTTMDT
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)
 
Html
HtmlHtml
Html
 
9. Php MongoDB cautarea unui document
9. Php MongoDB cautarea unui document9. Php MongoDB cautarea unui document
9. Php MongoDB cautarea unui document
 
5. Php MongoDB vederea unui singur document
5. Php MongoDB vederea unui singur document5. Php MongoDB vederea unui singur document
5. Php MongoDB vederea unui singur document
 
Html class-04
Html class-04Html class-04
Html class-04
 
Database connectivity in PHP
Database connectivity in PHPDatabase connectivity in PHP
Database connectivity in PHP
 
HTML 5 Simple Tutorial Part 4
HTML 5 Simple Tutorial Part 4HTML 5 Simple Tutorial Part 4
HTML 5 Simple Tutorial Part 4
 
8. Php MongoDB stergerea unui document
8. Php MongoDB stergerea unui document8. Php MongoDB stergerea unui document
8. Php MongoDB stergerea unui document
 
Sessionex1
Sessionex1Sessionex1
Sessionex1
 

Mais de Razvan Raducanu, PhD

Mais de Razvan Raducanu, PhD (20)

12. edit record
12. edit record12. edit record
12. edit record
 
11. delete record
11. delete record11. delete record
11. delete record
 
10. view one record
10. view one record10. view one record
10. view one record
 
9. add new record
9. add new record9. add new record
9. add new record
 
8. vederea inregistrarilor
8. vederea inregistrarilor8. vederea inregistrarilor
8. vederea inregistrarilor
 
7. copy1
7. copy17. copy1
7. copy1
 
6. hello popescu 2
6. hello popescu 26. hello popescu 2
6. hello popescu 2
 
5. hello popescu
5. hello popescu5. hello popescu
5. hello popescu
 
4. forme in zend framework 3
4. forme in zend framework 34. forme in zend framework 3
4. forme in zend framework 3
 
3. trimiterea datelor la vederi
3. trimiterea datelor la vederi3. trimiterea datelor la vederi
3. trimiterea datelor la vederi
 
2.routing in zend framework 3
2.routing in zend framework 32.routing in zend framework 3
2.routing in zend framework 3
 
1. zend framework intro
1. zend framework intro1. zend framework intro
1. zend framework intro
 
18. images in symfony 4
18. images in symfony 418. images in symfony 4
18. images in symfony 4
 
16. edit data
16. edit data16. edit data
16. edit data
 
12.doctrine view data
12.doctrine view data12.doctrine view data
12.doctrine view data
 
11. move in Symfony 4
11. move in Symfony 411. move in Symfony 4
11. move in Symfony 4
 
10. add in Symfony 4
10. add in Symfony 410. add in Symfony 4
10. add in Symfony 4
 
9. lower in Symfony 4
9. lower in Symfony 49. lower in Symfony 4
9. lower in Symfony 4
 
8. radio1 in Symfony 4
8. radio1 in Symfony 48. radio1 in Symfony 4
8. radio1 in Symfony 4
 
7. copy2 in Symfony 4
7. copy2 in Symfony 47. copy2 in Symfony 4
7. copy2 in Symfony 4
 

Último

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Último (20)

Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 

15. view single data

  • 1. View single data in Symfony 4
  • 2. Vederea data.html.twig {% extends 'base.html.twig' %} {% block body %} <table> <tr> <th>Nume</th> <th>Culoare</th> <th>Marime</th> <th>Pret</th> <th>Actions</th> </tr> {% for key in flowers %} <tr> <td>{{ key.nume }}</td> <td>{{ key.culoare }}</td> <td> {{ key.marime }}</td> <td>{{ key.pret }}</td> <td><a href="{{ app.request.baseUrl() }}/show/{{key.id}}">View</a></td> </tr> {% endfor %} </table> <a href="{{ app.request.baseUrl() }}/data/add">Insert a record</a> {% endblock %}
  • 3. Vederea data/show.html.twig {% extends 'base.html.twig' %} {% block body %} <table> <tr> <th>Nume</th> <th>Culoare</th> <th>Marime</th> <th>Pret</th> </tr> <tr> <td>{{ flower.nume }}</td> <td>{{ flower.culoare }}</td> <td> {{ flower.marime }}</td> <td>{{ flower.pret }}</td> </tr> </table> <a href="{{ app.request.baseUrl() }}/data">Back</a> {% endblock %}
  • 4. Controller-ul DataController <?php namespace AppController; use SymfonyComponentRoutingAnnotationRoute; use SymfonyBundleFrameworkBundleControllerController; use SymfonyComponentHttpFoundationRequest; use AppEntityFlower; use SymfonyComponentFormExtensionCoreTypeTextType; use SymfonyComponentFormExtensionCoreTypeNumberType; use SymfonyComponentFormExtensionCoreTypeSubmitType; use SensioBundleFrameworkExtraBundleConfigurationMethod; class DataController extends Controller { ……………………………………………………….
  • 5. ……………………………………………………. /** * @Route("/show/{id}") * @Method({"GET", "POST"}) */ public function showAction($id) { $flower = $this->getDoctrine()- >getRepository(Flower::class)->find($id); return $this->render('data/show.html.twig', array('flower' => $flower)); }