with an arbitrary depth and width, as long as the relationships actually
exists and the correct column data has been supplied.
-
Instead of hashrefs of plain related data (key/value pairs), you may
also pass new or inserted objects. New objects (not inserted yet, see
L</new>), will be inserted into their appropriate tables.
year => 2005,
});
- if( $cd->in_storage ) {
+ if( !$cd->in_storage ) {
# do some stuff
$cd->insert;
}
to call L<DBIx::Class::Row/insert> to save the newly created row to the
database!
- my $cd = $schema->resultset('CD')->update_or_new(
- {
- artist => 'Massive Attack',
- title => 'Mezzanine',
- year => 1998,
- },
- { key => 'cd_artist_title' }
- );
-
- if( $cd->in_storage ) {
- # do some stuff
- $cd->insert;
- }
-
=cut
sub update_or_create {