Write code that will automatically convert retrieved rows of database data into PHP objects with properties populated using record values.
- [Instructor] In this movie, we're going to learn…to build objects using the values…that we pull back from records in the database.…This is the first part of the active record process.…Database records are retrieved, which we've already done,…but then their values are going to be used…to populate the properties of objects.…And this process needs to happen automatically.…That's why it's called active record.…It feels like there's an active relationship…between the database data and our object.…So as soon as we pull those values back,…we want to immediately populate a new instance…of bicycle with them.…
At the moment, we don't have the active record pattern.…What we have is a result set,…and then we're able to go through…and fetch associative arrays out of that result set,…which we can then use.…Instead, what we want is for find_all…to return an array of objects to us,…objects that are already populated with the correct values.…So in order to do that,…what we want to do is take these two lines, 55 and 56,…and we want to cut those,…
Note: This is an intermediate-level training course that assumes you have existing knowledge of PHP. To refresh your skills, check out PHP Essential Training and PHP: Object-Oriented Programming.
- Creating a project database and tables
- Connecting to the database
- Database queries with OOP
- The active record design pattern
- Defining a database-driven class
- Performing common database tasks with OOP
- Creating inheritable and reusable code
- Object-oriented user authentication
- Object-oriented pagination
Skill Level Intermediate
Consuming RESTful APIs in PHP with Guzzlewith Justin Yost2h 12m Intermediate
PHP: Accessing Databases with PDO and MySQLiwith David Powers3h 47m Intermediate
1. Overview and Project Setup
2. The Database Connection
3. Define a Database-Driven Class
4. Object-Oriented CRUD
5. Object-Oriented Authentication
6. Object-Oriented Pagination
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.