Multiple automatic wheres

0

I was seeing in CodeIgniter that there is a way to insert multiple 'where' into class DB :

Example:

$this->db->where('id', 1)
     ->where('name', 'Jão')
     ->where('lastname', 'Fulaninho')
     ->get('users')
     ->result();

The question here is that in where some words are automatically inserted into each new where that I put up where (...) or where (...) and so on.

What is the name of this form of programming in POO . So I make my own classes that way.

    
asked by anonymous 30.03.2017 / 17:14

1 answer

1

Some have talked about method threads, and that's correct. But I also find it important to cite that it can also be called Fluent Interface .

But speaking more specifically of Codeigniter Active Records, I think the easiest term for you to find references that would help you create a similar functionality would be: Sql Query Builder (Sql Query Builder).

See some sample libraries:

07.04.2017 / 04:52