I’m fairly new to PHP (about a year-and-a-quarter of experience with coding PHP, or coding at all), quite new to the concept of MVC and OOP (about 5 months ago I really started looking into these, haven’t executed an official ‘project’ with them yet but done plenty of hobby-coding with them), and VERY new to Yii itself (about two weeks-ish?). I was mainly using CodeIgniter for my personal coding before now but I’ve recently been hired at a new job that primarily uses Yii, so I’m experimenting with it and trying to get myself up to a reasonable speed.
Sadly it seems uncertain if I’ll be able to do that, since I’ve come to the conclusion that I may not entirely understand MVC as a concept, let alone execute it in a professional environment.
See, when I started working with CodeIgniter and MVC, I always read the ‘Model’ portion of that equation as ‘the data’, which to my largely-inline-PHP mind meant: ‘the database’. So I assumed - perhaps foolishly - that the Model’s job was to work with the database and pass information back to the Controller. However, as I was reading through Yii’s documentation, the example Yii gave of a Model had to do with a contact form, and expressing the fields of the contact form as an array of values.
I’ll be honest; I’ve read that documentation and have read other works as well, and I’m really struggling to understand the Model. It seems, as a concept, to be far more abstract an idea than the Controller or View. Most of what I read says only, or in essence, that it ‘represents the data and does not depend on the View or Controller’. I might just be super-junior at this, but that… doesn’t really explain to me what it should actually be DOING.
Is anyone able to maybe give me a run-down, as though you’re talking to an idiot (because I am!) of what the Model’s role is in all this?