PHQL + Vokuro, really confused.

Hi.

Since there isn't much documentation for Vokuro on Github or the docs.phalconphp.com so i'll ask here.

I don't understand how Vokuro get it's information from the database, there must be some kind of queries in it.

https://github.com/phalcon/vokuro/blob/master/app/models/Users.php for example has multiple hasMany() functions but that doesn't make sense to me at all.

In the controller, https://github.com/phalcon/vokuro/blob/master/app/controllers/UsersController.php does it for example call this

$user = Users::findFirstById($id);

i guess it does something under the hood, but i don't get it.

help.



5.6k

Read up on models.



14.2k

Read up on models.

That helped a little :) makes more sense, but then.. how about findFirstById() or

$confirmation = EmailConfirmations::findFirstByCode($code);

How do they "ByCode" ?



84.5k

This is called a 'Finder':

$confirmation = EmailConfirmations::findFirstByCode($code);

It's the same as:

$confirmation = EmailConfirmations::findFirst(array("code = ?0", 'bind' => array($code)));

Model EmailConfirmations has a field called 'code'



14.2k

Okay.

So if i have a public variable called $status Can i also do "findFirstByStatus()" ?



84.5k

Not exactly, those must be fields in the mapped table, not attributes of the class.

Okay.

So if i have a public variable called $status Can i also do "findFirstByStatus()" ?