Answer the question
In order to leave comments, you need to log in
Is the filtering method implemented correctly?
Guys, did I make the implementation of this class correctly. In particular, the filter() method. If the method is not called, then we display all the lines.
$invoice = new Invoice(DB::init());
$invoice->setUser(1);
$invoice->filter('company_name', 'ромашка');
$invoice->filter('company_inn', '123451234512');
$invoice->filter('email', '[email protected]');
$rows = $invoice->selectAll();
...
echo '<br>Всего найдено фирм: '.$invoice->count_rows();
Answer the question
In order to leave comments, you need to log in
There is no concept in the code of the concept of correctly or incorrectly self-written, if it is not quite trash or noodles.
Whether it works or not is the main criterion.
Like or dislike (for yourself) is the second most important criterion.
And why not spy on popular solutions?
https://www.yiiframework.com/doc/guide/2.0/en/db-q...
As I understand it, yours ->filter('email', '[email protected]');
can only build 1 type of query. And if you need like, <>, etc.? Will you create another method?
And I agree with Alexander Aksentiev , new Invoice(DB::init())
this is very strange, you must admit it looks more beautifulInvoice::find()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question