Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Cakefest 2024 Workshop 1
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Jorge M. González Martín
July 23, 2024
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Cakefest 2024 Workshop 1
Jorge M. González Martín
July 23, 2024
More Decks by Jorge M. González Martín
See All by Jorge M. González Martín
CakeFest 2025 Workshop 1
steinkel
0
54
CakeFest 2023 Workshop 1
steinkel
0
52
CakeFest 2022 Workshop 1
steinkel
0
420
Cakefest 2021 Workshop 1
steinkel
0
480
Cakefest 2020 Workshop 1 and 4
steinkel
1
680
CakePHP Online Meetup 2
steinkel
0
130
Cakefest 2019 Basic Workshop
steinkel
0
1k
Featured
See All Featured
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
290
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
440
GitHub's CSS Performance
jonrohan
1033
470k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
480
How to build a perfect <img>
jonoalderson
1
6.1k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
500
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
490
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
710
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
560
Automating Front-end Workflow
addyosmani
1369
210k
Transcript
CakeFest 2024 Luxembourg Workshop 1
Workshop 1 • 3h session • Quick CakePHP project setup
• Building a plugin from scratch: Report builder • Code https:/ /github.com/steinkel/cakefest2024 • Database https:/ /github.com/steinkel/cakefest2024/blob/master/db.sql • Slides
About Jorge González https:/ /phpc.social/@steinkel • VP at CakeDC
[email protected]
https:/ /www.cakedc.com
CakePHP Introduction • Setting up a development environment • Example
application • Baking our application CRUD
Setup dev environment • Requirements $ sudo apt install -y
php-cli php-intl php-mbstring php-sqlite3 zip php-zip // setup composer 5
OR Use ddev • Check https:/ /ddev.readthedocs.io/en/stable/ 6
Composer • Create a CakePHP 5 project • https:/ /github.com/cakephp/app
$ composer create-project cakephp/app cakefest2024 Installing... … Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]? ←Y {skeleton} 7
Configure ddev $ ddev config # edit .ddev/config.yml file $
ddev get --list # install phpmyadmin 8
Configuration • Application class • CakePHP Bootstrap • config/bootstrap.php •
config/app.php • Configure default datasource via environment (done for you by ddev in .env) 9
• Database download URL: https:/ /raw.githubusercontent.com/steinkel/cakefest2024/master/db.sql • ddev import-db Database
schema 10
$ bin/cake bake all --everything --prefix Admin (you will need
to setup Admin prefix routing) Bake Shell • Build a CRUD for our tables 11
Plugins • CakePHP Plugins
• https:/ /github.com/FriendsOfCake/awesome-cakephp • Plugin setup and configuration • We'll
set up an existing plugin later today Plugin concepts 13
Report Builder • New, generic plugin • Provide simple reporting
features to existing CakePHP projects
15
16
17
18
19
20
• bin/cake bake plugin ReportBuilder • Tweak routes and initial
configuration Let's go! 21
• bin/cake bake migration initial --plugin ReportBuilder cake bake model
--table rb_reports Reports --plugin ReportBuilder cake bake controller Reports --plugin ReportBuilder cake bake template Reports --plugin ReportBuilder Start with a migration 22
• bin/cake bake migration addStartingTable --plugin ReportBuilder Add the starting
table 23
• We need to be sure the starting table exists
Add validation 24
• Build editAssociations action, add javascript to navigate associations Navigate
associations 25
• Create new table to store the associations • Use
Ajax to save associations • Do not save duplicated associations Add association (save) 26
• Add new type to store comma separated values to
store the selected columns Create new Database Type 27
• Use the associations to select the columns for the
report • Save the selected columns as comma separated Select columns 28
• Prepare initial report run with contained associations Run the
report 29
• Add the selected columns to the report run Add
selected columns 30
• Store the filters as json • Add a filter
widget for the starting table Add filter widget 31
• Create logic to parse the filters and apply them
to the query executed Apply filters to report run 32
• Create another filter for relative dates, like "this week"
Add filter for relative dates 33
• Add simple pagination to report run Add Simple Pagination
34
• Add headers to the starting table in report run
Add Headers 35
• In case we want to fetch the data using
an endpoint Add a simple API 36
Consume API for charts 37
• In case we want to fetch the data using
an endpoint Add a simple API 38
Questions ?
Thank You ありがとうございました。 Gracias
• Create a widget to provide autocomplete filter for associations
following conventions Autocomplete association 41