Log message #3942042

# At Username Text
# Oct 4th 2016, 07:06 spriz Thanks @ndm :slightly_smiling_face:
# Oct 4th 2016, 07:05 spriz Ah! Then I donâ??t want to start looking more into it and just accept it :slightly_smiling_face:
# Oct 4th 2016, 07:05 ndm Because aliases in update queries are differently implemented in the various dialects (and SQLite doesn't support it at all IIRC), and nobody yet had the guts trying to implement support for this
# Oct 4th 2016, 07:04 spriz yeah but since itâ??s basically just an â??updateAllâ? to the table - I donâ??t understand *why* it doesntâ?? work with aliases
# Oct 4th 2016, 07:03 spriz (I like the readability of having aliases :P)
# Oct 4th 2016, 07:03 ndm @spriz The underlying update query is being built without aliases, that's the CakePHP default
# Oct 4th 2016, 06:57 spriz eg. `[â??Subscriptions.company_idâ?? => $id]` fails while `[â??company_id' => $id]` doesn't
# Oct 4th 2016, 06:56 spriz anyone using UseMuffin/Trash that can tell my why I canâ??t use aliased field in the conditions to `trashAll()`
# Oct 4th 2016, 06:23 admad ionas: seems github couldn't handle anymore of your PRs :)
# Oct 4th 2016, 06:16 ra7bi and check the count before generate PDF
# Oct 4th 2016, 06:16 ra7bi i will use Find ,
# Oct 4th 2016, 06:15 ra7bi Yes it's in a Controller
# Oct 4th 2016, 06:14 ndm otherwise use `find()` instead
# Oct 4th 2016, 06:14 ndm well, if this is in a controller action which's only purpose is to generate the PDF file, then just letting the exception bubble up may be reasonable
# Oct 4th 2016, 06:12 ra7bi the pdf file shouldn't be generated
# Oct 4th 2016, 06:12 ra7bi so if there is no data
# Oct 4th 2016, 06:12 ra7bi This query is for generating PDF file
# Oct 4th 2016, 06:12 ndm depends on what for you need that info
# Oct 4th 2016, 06:11 ra7bi so what is the best way to check if the query returning row or it's empty ,
# Oct 4th 2016, 06:11 ksandeep_ Hi, how i can set layout for admin from AppController. $this->viewBuilder()->layout('admin'); is not working for me in initialize method.
# Oct 4th 2016, 06:10 ndm I probably shouldn't have said "_nothing_", as in that case it will throw an exception
# Oct 4th 2016, 06:09 ra7bi Okay so it's okay to check like this if($participant) {
# Oct 4th 2016, 06:09 ndm `get()` will either return 1 record, or nothing, that's why...
# Oct 4th 2016, 06:09 ra7bi this code giving me Error ``` Error: Call to undefined method App\Model\Entity\Participant::count() ```
# Oct 4th 2016, 06:08 slackebot1 $totalResult = $participant->count(); ```
# Oct 4th 2016, 06:08 ra7bi ``` // Check if the person is okay . $participants = TableRegistry::get('Participants'); $participant = $participants->get($this->request->data(['participant_id']),[ 'contain' => ['Distributors', 'Events','Payments'], 'conditions' => [ 'Events.start_date >= NOW()', //'distributors.id'=>$this->Auth->user('distributor_id') ]
# Oct 4th 2016, 06:08 ra7bi i want to know how many records returning from the query
# Oct 4th 2016, 06:08 ra7bi why i cant use count method with $query->get
# Oct 4th 2016, 06:08 ra7bi hi
# Oct 4th 2016, 04:07 ndm http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#countercache-cache-your-count
# Oct 4th 2016, 04:07 ndm However you could write that query using joins too... or use a counter cache
# Oct 4th 2016, 04:06 ndm @justrohu Then you're going to have a bad time in case `fields` doesn't accept (subquery) expressions (haven't used 2.x for quite some now, not sure if it works): http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#sub-queries
# Oct 4th 2016, 04:03 justrohu @ndm: what if I want to run subquery like select user.id, (select count(*) from cars where cars.user_id = users.id) as car_count from users
# Oct 4th 2016, 04:00 justrohu @ndm: Thank you
# Oct 4th 2016, 03:59 slackebot1 association conditions in case you've defined some in your association setup.
# Oct 4th 2016, 03:59 ndm @justrohu You must for `hasMany` and `hasAndBelongsToMany` associations, as they are being retrieved in a separate query if you include them via `contain` or an according `recursive` level. For `belongsTo` and `hasOne` it should be possible to just include the associations via `contain` or `recursive` as they are being retrieved in the main query (they may not use the `INNER` join type though). Also don't forget that you may have to include poss
# Oct 4th 2016, 03:50 justrohu @ndm : thank you, please correct me if I am wrong here, "For data with conditions on associated hasMany table I must / always have to use join"
# Oct 4th 2016, 03:47 savant @backstageel any reason why you requested the github integration?
# Oct 4th 2016, 03:46 slackebot1 <http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#complex-find-conditions
# Oct 4th 2016, 03:46 ndm @justrohu You can't refer to something that doesn't exist in your query, you need to join the car table in. http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#joining-tables> Use an `INNER` join, and in case a user can have multiple cars of the same name, don't forget to group by the users primary key (or do a distint select on it) in order to avoid getting duplicate results.
# Oct 4th 2016, 03:38 justrohu any body please help me