สร้าง Controller  คือ ส่วนจัดการข้อมูล คำนวณ ประมวลผล สั่งการทำงาน หรือ Coding หลักๆ ซึ่งการสร้าง Controller จะมีความสัมพันธ์กับการสร้างเเละกำหนด Routing ทำให้เราสามารถที่จะสร้าง Controller กี่ Controller ก็ได้ภายใน Bundle

วิธีการ Create Controller

1. สามารถที่จะ Run Command ผ่าน Netbeans ได้เลย ดังรูป

2. ให้เลือกที่คำสั่ง Command generate:controller


3. จากนั้น Command จะให้เราใส้ข้อมูลที่จะสร้าง Controller
Controller name: SitetestBundle:block


SitetestBundle ได้จาก ตอนเราสร้าง Bundle เราต้องระบุชื่อไปว่าจะใช้ของ Bundle ตัวใด จากนั้น : block คือชื่อ controller

Determine the format to use for the routing.

Routing format (php, xml, yml, annotation) [annotation]:  yml

Determine the format to use for templating.

Template format (twig, php) [twig]: [Enter ได้เลย]

Instead of starting with a blank controller, you can add some actions now. An action
is a PHP function or method that executes, for example, when a given route is matched.
Actions should be suffixed by Action.

New action name (press <return> to stop adding actions): [Enter ได้เลย]

Do you confirm generation [yes]?: [Enter ได้เลย]

Generating the bundle code: OK

สำหรับคำสั่ง Commands line ให้ทำการพิมพ์คำสั่งนี้

$ php app/console generate:controller
เลือกวิธีกันได้ตามสะดวกนะทุกคน เมื่อสร้างเสร็จก็จะได้ไฟล์ ตามภาพที่แสดง 
แล้วเราก็ไปกันต่อในบทต่อไปเลย

 

กระทู้ล่าสุดจากเว็บบอร์ด
หัวข้อกระทู้
ตอบ
เปิดดู
ล่าสุด
การทำงานกับ Cookies ใน Selenium
โดย athirach.offcial จ 01 เม.ย. 2024 12:03 pm บอร์ด Software testing
0
120
จ 01 เม.ย. 2024 12:03 pm โดย athirach.offcial View Topic การทำงานกับ Cookies ใน Selenium
การเขียน Selenium ให้แจ้งเตือน Message Error
โดย athirach.offcial จ 01 เม.ย. 2024 11:59 am บอร์ด Software testing
0
113
จ 01 เม.ย. 2024 11:59 am โดย athirach.offcial View Topic การเขียน Selenium ให้แจ้งเตือน Message Error
เครื่องมือที่ช่วยในการทำ Automated test ใน python
โดย athirach.offcial จ 01 เม.ย. 2024 11:51 am บอร์ด Software testing
0
110
จ 01 เม.ย. 2024 11:51 am โดย athirach.offcial View Topic เครื่องมือที่ช่วยในการทำ Automated test ใน python
selenium เวอร์ชั่น ปัจจุบัน เป็นเวอร์ชั่นที่เท่าไหร่
โดย athirach.offcial จ 01 เม.ย. 2024 11:39 am บอร์ด Software testing
0
87
จ 01 เม.ย. 2024 11:39 am โดย athirach.offcial View Topic selenium เวอร์ชั่น ปัจจุบัน เป็นเวอร์ชั่นที่เท่าไหร่
ปัจจัยที่ทำให้เกิด Spam score ในเว็บไซต์
โดย athirach.offcial จ 01 เม.ย. 2024 11:27 am บอร์ด Share Knowledge
0
151
จ 01 เม.ย. 2024 11:27 am โดย athirach.offcial View Topic ปัจจัยที่ทำให้เกิด Spam score ในเว็บไซต์
Dell Optiplex 980 ไม่รองรับแรม Rank แบบ Single Rank
โดย mindphp จ 01 เม.ย. 2024 1:55 am บอร์ด ถาม - ตอบ คอมพิวเตอร์
0
349
จ 01 เม.ย. 2024 1:55 am โดย mindphp View Topic Dell Optiplex 980 ไม่รองรับแรม Rank แบบ Single Rank
การจัดประเภทของการ Test โปรแกรม
โดย athirach.offcial ส 30 มี.ค. 2024 12:54 pm บอร์ด Software testing
0
215
ส 30 มี.ค. 2024 12:54 pm โดย athirach.offcial View Topic การจัดประเภทของการ Test โปรแกรม
เทคนิคการเขียน Test Case ให้ครอบคลุม
โดย athirach.offcial ส 30 มี.ค. 2024 12:50 pm บอร์ด Software testing
0
169
ส 30 มี.ค. 2024 12:50 pm โดย athirach.offcial View Topic เทคนิคการเขียน Test Case ให้ครอบคลุม