Next 2.6 Changing model of live data Prev

Changing model of live data

At some point we realize that attaching one order per User was a mistake. Possible steps to refactor our model:

#!/usr/bin/perl -w

use Podius;
use Podius::Shortcuts;

my $cache = create_component_cache();
my $center = $cache->get_component("Center", 1) or die "No Center";

$cache->begin_tx;

# foreach_user is our Podius::Component::Center method
$center->foreach_user(sub {
        my $user = shift;
        my $order = $cache->create_component("Order");
        $order->details($user->order_details);
        $user->orders->add($order);
});   

$cache->commit_tx;

Next Content Management with Podius Prev