Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Your example would work, but there's a reason you might want different keys. My company's current web app is written in CakePHP, which has a love for arrays. Some of my queries look like this:

  $booking = $this->Booking->find('first', array('conditions' => array('Booking.booking_id' => $id), 'contain' => array('Review', 'Desk' => array('fields' =>
 array('provider_id', 'category_id'), 'Provider' => array('city', 'name'), 'ProviderCategory' => array('fields'   => array('provider_id', 'category_id'), 'DeskCategory' => 'name')))));
It's essentially not readable, but with [] it would work much better, and I still want to give keys to arrays.


As an FYI, you might want to look into custom find methods if you haven't already: https://github.com/josegonzalez/documentation/blob/master/03...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: