Here is a sample of some code I use in a Trailer rental application. This 
is a method from the Rental Controller.

Rental hasMany Trailers and hasMany Lessees

public function archived($id = null) {


        $options = array(
          'limit' => 10,
          'order' => 'Trailer.number ASC',
          'fields' => array('id', 'trailer_id', 'lessee_id', 'date_out', 
'rented', 'agreement_number'),
          'conditions' => array(
              'Rental.deleted' => '1',
          ),
          'contain' => array(
              'Trailer' => array(
                  'fields' => array('id', 'number', 'make', 'license'),
              ),
              'Lessee' => array(
                  'fields' => array('id', 'account', 'name'),
              )
          )
        );


        $this->paginate = $options;
        $this->set('rentals', $this->paginate());
 }


Turning off recursive, and using Containable provides a very flexible and 
readable method of building a query. Adding conditions, fields, associated 
models etc is a snip. Whoever produced this method of working should be 
fully credited.

My question is, how would something like this be created in CakePHP 3? 
There seem to be many many more pages to read and understand regarding the 
new ORM, and I'm really unsure how simple it will be to convert. Will I be 
able to achieve it in the a similar manner, and will it be as readable, and 
easy to edit?

Are there any examples in the new Manual (I can't find any), where the new 
ORM is used to bring all the new methods of working together in much the 
same way as the method above?

Thanks

Dave

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to