GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TEST::DBIX::CLASS::FIXTURECOMMAND::POPULATE (3)

.ds Aq ’

NAME

Test::DBIx::Class::FixtureCommand::Populate - Install fixtures using Populate

CONTENTS

SYNOPSIS



        my $command = Test::DBIx::Class::FixtureComand::Populate->new(schema=>$schema);
        $command->install_fixtures($fixtures);



DESCRIPTION

This uses the populate in DBIx::Class::Schema method to install fixture data. Expects an hash of Source => [\@fields, \@rows]. Please see the ’populate’ method for more information. Examples:



        ->install_fixtures(
                Person => [
                        [name, age],
                        [john, 40],
                        [vincent, 15],
                ],
                Job => [
                        [title => description],
                        [programmer => Who wrote the code],
                        [marketer => Who sold the code],
                ],
        );



You may include as many Sources as you like, and even the same one more than once.

For additional flexibility with various configuration formats, we accept three variations of the incoming arguments:



        ## Array of HashRefs
        ->install_fixtures(
                {Person => [
                        [name, age],
                        [john, 40],
                        [vincent, 15],
                ]},
                {Job => [
                        [title => description],
                        [programmer => Who wrote the code],
                        [marketer => Who sold the code],
                ]},
        );

        ## ArrayRef
        ->install_fixtures([
                Person => [
                        [name, age],
                        [john, 40],
                        [vincent, 15],
                ],
                Job => [
                        [title => description],
                        [programmer => Who wrote the code],
                        [marketer => Who sold the code],
                ],
        ]);

        ## ArrayRef of HashRefs
        ->install_fixtures([
                {Person => [
                        [name, age],
                        [john, 40],
                        [vincent, 15],
                ]},
                {Job => [
                        [title => description],
                        [programmer => Who wrote the code],
                        [marketer => Who sold the code],
                ]},
        ]);



This should allow you to model your fixtures in your configuration format of choice without a lot of trouble.

METHODS

This class defines the following methods

    install_fixtures

Takes an Array or ArrayRef of arguments and installs them into your target database. Returns an array of hashrefs, where each hashref is a {$source => @rows} pair.

AUTHOR

John Napiorkowski <jjnapiork@cpan.org>

COPYRIGHT & LICENSE

Copyright 2009, John Napiorkowski <jjnapiork@cpan.org>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TEST::DBIX::CLASS::FIXTURECOMMAND::POPULATE (3) 2015-10-01

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.