Log message #4212861

# At Username Text
# Nov 8th, 10:29 dev.cyrusjayson it is not a field. it is association in users model
# Nov 8th, 10:28 slackebot1 'foreignKey' => 'user_id' ]); $this->hasMany('Suborders', [ 'foreignKey' => 'order_id' ]); } ```
# Nov 8th, 10:28 dev.cyrusjayson ``` public function initialize(array $config) { parent::initialize($config); $this->setTable('orders'); $this->setDisplayField('id'); $this->setPrimaryKey('id'); $this->belongsTo('Customers', [ 'foreignKey' => 'customer_id' ]); $this->belongsTo('Statuses', [ 'foreignKey' => 'status_id' ]); $this->belongsTo('Users', [
# Nov 8th, 10:28 dev.cyrusjayson ```
# Nov 8th, 10:28 slackebot1 $validator; } ```
# Nov 8th, 10:28 dev.cyrusjayson ``` public function validationDefault(Validator $validator) { $validator ->integer('id') ->allowEmptyString('id', null, 'create'); $validator ->scalar('name') ->maxLength('name', 255) ->allowEmptyString('name'); $validator ->scalar('code') ->maxLength('code', 45) ->allowEmptyString('code'); return
# Nov 8th, 10:27 challgren ‘user’ isn’t though
# Nov 8th, 10:27 dev.cyrusjayson yes ``` protected $_accessible = [ 'user_id' => true, 'name' => true, 'customer_id' => true, 'status_id' => true, 'remarks' => true, 'is_paid' => true, 'date_created' => true, 'customer' => true, 'status' => true, 'suborders' => true ]; ```
# Nov 8th, 10:27 challgren is the field accessible?
# Nov 8th, 10:26 dev.cyrusjayson it just seems cake don’t know user_id added
# Nov 8th, 10:26 dev.cyrusjayson there is no error though
# Nov 8th, 10:26 dev.cyrusjayson I cant see it also. and I have association that gives user as null. but the user_id is not also there
# Nov 8th, 10:25 challgren Check `$entity>errors()`
# Nov 8th, 10:25 dev.cyrusjayson I added new field name user_id in table [11:14 AM] it is not saving [11:14 AM] even I was passing the data
# Nov 8th, 10:12 jotpe Hey :wave:
# Nov 8th, 09:31 dereuromark If they can be null why are they relevant for the query? ;) i think this is a design issue in most cases.
# Nov 8th, 09:25 spriz I would assume the performance of such query is not great :) :)
# Nov 8th, 09:25 roel Oh thanks :)
# Nov 8th, 09:24 roel @spriz the date columns can be `null`
# Nov 8th, 09:19 spriz @roel but one way could be this: https://gist.github.com/Spriz/3862a1bee5a8d67ef7b85434e61be9ad
# Nov 8th, 09:14 noel @martonmiklosqdev I suggest you use xdebug in that case. Not sure why the line numbers aren't showing up correctly for you. This happens to me in JavaScript quite often and it's very annoying. I've never seen it in PHP.
# Nov 8th, 09:13 spriz @roel does the date column really have `0` and not `null` in the DB?
# Nov 8th, 08:59 roel `SELECT * FROM `<table>` WHERE `<fk_id>` IN (1,2)` ` ORDER BY GREATEST(COALESCE(`<date_column_1>`, 0), COALESCE(`<date_column_2>`, 0)) DESC` ` LIMIT 10`
# Nov 8th, 08:59 roel The query is as follows:
# Nov 8th, 08:59 roel Hello everyone, I have a SQL query that I would like to convert to a cakephp (3.6) query, but I have no clue how to do it and if it is even possible.
# Nov 8th, 08:19 javier.villanueva I think that your models are different than the models im thinking
# Nov 8th, 08:18 javier.villanueva morning all
# Nov 8th, 06:36 conehead Morning!
# Nov 8th, 06:17 alexdd55976 Morning
# Nov 8th, 01:50 ndm Check `$context['newRecord']`
# Nov 8th, 01:47 francisdoydora thanks in advance for your help :slightly_smiling_face:
# Nov 8th, 01:47 francisdoydora if update, allowEmptyFile. Else if create, follow the validator rule I posted.
# Nov 8th, 01:37 slackebot1 (isset($context['data']['academic_level_id'])) { return $context['data']['academic_level_id'] === '1'; } return true; })```
# Nov 8th, 01:37 francisdoydora if anyone could help me figure out how to return 'update' as default. But needs to return true or false on create. Right now allowEmptyFile returns false if academic_level_id is not equal to 1. But I didn't take into account if I want to edit. In edit it should always allow empty files. ```$validator ->allowEmptyFile('gmrc', 'Please upload a GMRC', function ($context) { if
# Nov 7th, 23:24 mrfeedback is there a way to disable a virtual field when a query is returning entities? In my case I dont need that specific field as it generates s3links which I wouldn´t use in that case. I tried to not select the field. but for some reason it still triggers
# Nov 7th, 22:41 slackebot1 <martonmiklosqdev>
# Nov 7th, 22:40 martonmiklosqdev I can see the problematic line in the variables pane:
# Nov 7th, 22:40 martonmiklosqdev the view errors a bit better
# Nov 7th, 22:40 martonmiklosqdev where the problem is in the view
# Nov 7th, 22:40 slackebot1 <martonmiklosqdev>
# Nov 7th, 22:39 martonmiklosqdev here is an another example