From the course: PHP: Object-Oriented Programming with Databases

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Admin validations

Admin validations - PHP Tutorial

From the course: PHP: Object-Oriented Programming with Databases

Start my 1-month free trial

Admin validations

- [Instructor] In this movie, we'll talk about how to add validations to our admin class in an object-oriented way. You'll recall that in the last chapter, we gave our DatabaseObject class a method called validate and it just has a real skeleton of a method there, just sets errors equal to nothing, and then returns those errors. What we need to do is add custom validations to the admin class that inherits from DatabaseObject. So, in admin.class.php, we want to add a new method down here which is also going to be the same type of method, protected function called validate, and it's going to override that behavior with its own behavior. I've included that in the exercise files for you. Let's open that file up. You can take all of these lines from protected function validate down to the bottom, and make sure I get that final curly brace. Let's copy all of that and let's go into admin and let's paste it in. Now, these validations are the exact same validations that we talked about in the…

Contents