Log message #3942048

# At Username Text
# Oct 4th 2016, 07:16 NeoThermic|Work oh my, I have a checked out version of the master repo from 1.3.x
# Oct 4th 2016, 07:15 cakephp261 how r u?
# Oct 4th 2016, 07:15 cakephp261 hii
# Oct 4th 2016, 07:15 cakephp261 hello
# Oct 4th 2016, 07:07 spriz Oh :slightly_smiling_face:
# Oct 4th 2016, 07:06 ndm no problem... also https://github.com/cakephp/cakephp/pull/9420 :slightly_smiling_face:
# 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.