Closed dpDesignz closed 4 years ago
I would need an full working SQL statement to use, the join functions was built from the specs of how it should be constructed.
I personally haven't used JOIN statements. I was going to add examples and phpunit tests, but really need an use case i would regularly use.
Anyway, now going over the methods i see the joining()
method, which leftjoin()
is calling have an check for empty($columnFields)
that is nowhere in the method signature call, nor the actual instructions. The reason for getting false
result. You should make some edits and do PR.
I would need an full working SQL statement to use, the join functions was built from the specs of how it should be constructed.
I personally haven't used JOIN statements. I was going to add examples and phpunit tests, but really need an use case i would regularly use.
Anyway, now going over the methods i see the
joining()
method, whichleftjoin()
is calling have an check forempty($columnFields)
that is nowhere in the method signature call, nor the actual instructions. The reason for gettingfalse
result. You should make some edits and do PR.
Sorry, I should have included a working example.
This is if I use query_prepared
(which is what I'm currently using to get my results)
$results = $this->conn->query_prepared(
"SELECT me_supplier.supplier_id, me_supplier.supplier_description, me_supplier.supplier_contact_id, me_contact.contact_name, me_contact.contact_email, me_contact.contact_phone, me_contact.contact_status, me_supplier.supplier_quick_code, me_supplier.supplier_account_code, me_supplier.supplier_gst_number, me_supplier.supplier_website
FROM me_supplier
LEFT JOIN me_contact ON me_supplier.supplier_contact_id = me_contact.contact_id
WHERE supplier_id = :supplierID", ["supplierID" => $supplierID]);
So this returns my results that I'm after no worries.
I'm not sure why it's checking for the column fields in line 253 of ezQuery When I ran XDebug it showed after I stepped out of the method into the selecting
method that's where it pulled the $columnFields
from the selecting
method. Maybe it just wasn't cleaned up when this method was created? The variable isn't referenced anywhere else in the method itself.
I've got the method working for myself. Will do a PR shortly. 😄
Maybe it just wasn't cleaned up when this method was created?
Yes, that's why the tests are so helpful to catch these types of misses/bugs. I would have not really seen it until I tried to use it, or a phpunit test was created.
You should work on adding an phpunit test covering the PR.
You should work on adding an phpunit test covering the PR.
Sorry, I still haven't gotten my head around how phpunit works yet. I'll look into maybe doing that when I have. I'm just working on updating the Wiki on here as I work things out for now. 😄
I see in the readme file it references that you can use a join in a
selecting
statement, but I can't seem to get it to work. Could someone please show me some examples on how this works? This is what I've tried so farSo far this tells me that there are no results, but there definitely are as the following works
I'm also wanting to be able to add
where
statements in there dynamically based on what a user puts in the URL.