Copyable Behavior
Copyable Behavior adds the ability to copy a model record, including all hasMany and hasAndBelongsToMany
associations. Copyable relies on Containable behavior, which this behavior will attach on the fly as needed. HABTM relationships are just duplicated in the join table, while hasMany and hasOne records are recursively copied as well.
associations. Copyable relies on Containable behavior, which this behavior will attach on the fly as needed. HABTM relationships are just duplicated in the join table, while hasMany and hasOne records are recursively copied as well.
Copyable adds a copy() function to your model, which you can use to copy (that is, create a duplicate of) a record and any of its hasOne, hasMany, or hasAndBelongsToMany relationships. In the case of hasOne and hasMany, those records are recursively copied as well. For example, if you want to copy a LinkCategory that hasMany Link, all of the Link records will be copied. The copy is fully recursive, meaning that if Link HasMany Comment, then all of those records will be copied as well. In the case of HABTM associations, only the join table rows are copied, not the associated records. The copy() function takes one argument – the ID of the record you wish to copy.
The code is on page two, but the most current version is kept on Github: http://github.com/jamienay/copyable_behavior
Copyable uses Containable to help generate its queries, but don’t worry – it’ll attach Containable if it can’t find it on the model.
A handful of config options:
* recursive: whether to copy hasOne- and hasMany-associated models (default: true)
* habtm: whether to copy hasAndBelongsToMany relationships (default: true)
* stripFields: an array model fields that should ignored when copying (default: id, created, modified, lft, rght)
After attaching Copyable to a model via the $actsAs array – I recommend putting it on AppModel – usage is as simple as:
Download code
The code is on page two, but the most current version is kept on Github: http://github.com/jamienay/copyable_behavior
Copyable uses Containable to help generate its queries, but don’t worry – it’ll attach Containable if it can’t find it on the model.
A handful of config options:
* recursive: whether to copy hasOne- and hasMany-associated models (default: true)
* habtm: whether to copy hasAndBelongsToMany relationships (default: true)
* stripFields: an array model fields that should ignored when copying (default: id, created, modified, lft, rght)
After attaching Copyable to a model via the $actsAs array – I recommend putting it on AppModel – usage is as simple as:
Download code
// From a controller method
$this->MyModel->copy($id);
// From a model method
$this->copy($id);
Comments
Comment
1 Page 2?
Purchase Insurance
Comment
2 thank you
Thanks,
Porno izle
Comment
3 food for thought
Passion RX
Comment
4 film indir
Comment
5 creativity
Seriously I’m really excited about learning more about the forex trading game - if you’re a forex trader I’d love to hear from you and compare notes - if you’ve used an automated forex trading system or a forex demo account to trade I want to hear how it went from you as well. Automated forex trading is the way of the future I think, great passive income.
Comment
6 Re:
Comment
7 behavior
suppliers network
Comment
8 nice
Comment
9 She
Sex izLe Porno Seyret Porno izLe Sikiş Seyret Sex Videoları Kızlık Bozma Sikiş Sikiş izLe Sex Tx
Canlı Seks Sex Hikayeleri Sikiş izLe Sikiş Seyret Cinsel Sohbet Sex Sohbet Cinsel Sohbet Türk Porno
Comment
10 great
SEROTEA.COM | Day Trans Travel Jakarta Bandung | Day Trans Travel Jakarta Bandung Memang Mantap | Tulisan Pendukung Day Tans Travel Jakarta Bandung | Day Trans SEO Challenge | Info Kontes Day Trans Travel Jakarta Bandung | Tutorial SEO Pemula | Day Trans Travel Jakarta Bandung | Day Trans Travel Jakarta Bandung | Day Trans Travel Jakarta Bandung | Day Trans Travel Jakarta Bandung | Day Trans Travel Jakarta Bandung | Day Trans Travel Jakarta Bandung | Day Trans Travel Jakarta Bandung | Day Trans Travel Jakarta Bandung | Travel Jakarta Bandung
Comment
11 ed
Comment
12 great!
criação de sites - desentupidora sp - amo niterói - djs, aluguel de som e iluminação para festas - download fotos - divulgar sites - tapetes personalizados
Comment
13 Copying feature is great
Seth
atContractor Marketing
Comment
14 thanks
Comment
15 is it free
Comment
16 burmeh yaza lida fx15 biber hapı ile formda girin
burmeh yaza lida fx15 biber hapı ile formda girin