# |
Feb 4th 2018, 18:05 |
hmic |
['field IS' => null] actually |
# |
Feb 4th 2018, 17:58 |
chris-andre |
‘MyControlle.dateTimeAttribute IS NULL’ |
# |
Feb 4th 2018, 17:53 |
bedo2991 |
I am currently using: $this->MyController->find('all', [ 'conditions'=>['MyController.dateTimeAttribute'=> null]]); |
# |
Feb 4th 2018, 17:52 |
bedo2991 |
Hi, how do I make cakephp3 generate "IS null" instead of "= null"? |
# |
Feb 4th 2018, 16:26 |
birdy247 |
or si there a better buzz word for this type of "software" |
# |
Feb 4th 2018, 16:25 |
birdy247 |
would you describe them as developing software? |
# |
Feb 4th 2018, 16:25 |
birdy247 |
If a company specialises in building cake php projects |
# |
Feb 4th 2018, 16:25 |
birdy247 |
off topic question |
# |
Feb 4th 2018, 15:31 |
kitcat711 |
trying to create a search form: when the user types several keywords, how do I create my query to get the results matching all the words (in a post title)? |
# |
Feb 4th 2018, 11:12 |
kitcat711 |
when matchning, the relation is based on the belongsToMany => I dont retrieve the authors |
# |
Feb 4th 2018, 11:11 |
kitcat711 |
Users hasMany ForumPosts (as an Author) and Users belongsToMany ForumPosts (as subscribers) |
# |
Feb 4th 2018, 11:10 |
kitcat711 |
help with matching not workinas expected |
# |
Feb 4th 2018, 10:35 |
turkles |
Are the results duplicated in any way? Not much to go on there.. |
# |
Feb 4th 2018, 07:26 |
itamer |
I have two tables in the join array, both get displayed in the sql but it's as if the second join and the order() get stripped off the query. |
# |
Feb 4th 2018, 07:22 |
itamer |
I've got a findAuth function so that the login function applies the correct rules. Within that function I have some debugging. If I run the query sql I get 3 results, if I look in the results of toArray() I have about 20 results. Any ideas what might be happening or how to debug? ob_start(); debug($query); debug($query->toArray()); $str = ob_get_contents(); ob_end_clean(); |
# |
Feb 4th 2018, 03:56 |
turkles |
a class outside of cakephp? |
# |
Feb 4th 2018, 03:52 |
admad |
I would suggest moving the fetch and processing logic in separate class. |
# |
Feb 4th 2018, 03:50 |
turkles |
at the moment I have a behaviour that handles the data grab in a generic fashion which I can then use in various models. I am struggling more with where I put the logic side, ie. initiate a fetch, process, and save, so that I can use in both a controller and a shell |
# |
Feb 4th 2018, 03:45 |
admad |
Checkout muffin/webservice plugin if you want to implement ORM type access to the webservice |
# |
Feb 4th 2018, 03:45 |
admad |
@turkles you can ake your own classes under a custom App\Webservice namespace. |
# |
Feb 4th 2018, 02:49 |
turkles |
Hi all, where would I keep code which fetches external API data, processes and stores the response in my database? I want to perform this from either a shell or a controller - as in some cases it will be cron driven, and in others a user on my website may request it? |
# |
Feb 4th 2018, 01:55 |
itamer |
Either way, the sql that gets shown when I debug isn't the sql that's getting run |
# |
Feb 4th 2018, 01:54 |
itamer |
I find contain works well for belongsTo but not hasMany |
# |
Feb 4th 2018, 01:50 |
ricksaccous |
table class* |
# |
Feb 4th 2018, 01:50 |
ricksaccous |
and then use contain |
# |
Feb 4th 2018, 01:50 |
ricksaccous |
i always just define associations in the table model itself |
# |
Feb 4th 2018, 01:50 |
ricksaccous |
to be honest i've never used the join method |
# |
Feb 4th 2018, 01:49 |
itamer |
aah, no, scratch that, toArray() also shows the wrong data, as if the joins are being ignored at run time even though the sql shows it |
# |
Feb 4th 2018, 01:47 |
itamer |
even though I see the sql when I debug $query somehow the records that get returned have the joins stripped off. Does that sound right? |
# |
Feb 4th 2018, 01:46 |
itamer |
@ricksaccous, if you're still around. I'm running findAuth to extend the rules on the records that get returned |
# |
Feb 4th 2018, 01:19 |
ricksaccous |
I had no idea where to begin debugging, was going to suggest possible foul play in the callback methods |
# |
Feb 4th 2018, 01:19 |
ricksaccous |
@itamer nice, glad you got it working |
# |
Feb 4th 2018, 01:18 |
itamer |
@ricksaccous somehow I just fixed it, been chasing my tail on this for hours. very frustrating. |
# |
Feb 4th 2018, 01:16 |
slackebot |
DESC', |
# |
Feb 4th 2018, 01:16 |
itamer |
'sql' => 'SELECT Individuals.id AS `Individuals__id`, Individuals.email AS `Individuals__email`, Individuals.password AS `Individuals__password` FROM individuals Individuals INNER JOIN memberships Memberships ON Individuals.membership_id = Memberships.id INNER JOIN finances Finances ON Finances.membership_id = :c0 WHERE (Individuals.email = :c1 AND Individuals.status in (:c2,:c3) AND Memberships.softdelete = :c4) ORDER BY Finances.enddate |
# |
Feb 4th 2018, 01:16 |
itamer |
but if I get the sql and paste it direct into the database (and tidy up the variables) I get the right data |
# |
Feb 4th 2018, 01:16 |
itamer |
that's right |
# |
Feb 4th 2018, 01:14 |
ricksaccous |
so you do a debug on $user after this and it's null? |
# |
Feb 4th 2018, 01:13 |
itamer |
yep, there are 3 records that match for the email I'm testing with, I want the first one |
# |
Feb 4th 2018, 01:13 |
ahmed_bodi |
exactly as i needed it to |
# |
Feb 4th 2018, 01:12 |
ahmed_bodi |
the core of the issue was actually using varchar's for the id's due to an auth plugin i had used prior, but removed all the old crap and convertedit all back to int's and now all works great |