my( $self, $new_parent ) = @_;
if ($new_parent) {
if (ref($new_parent)) {
- $new_parent = $new_parent->id() || 0;
+ $new_parent = $new_parent->id() || croak('Parent object does not have an id');
}
return 0 if ($new_parent == ($self->get_column($self->parent_column())||0));
$self->move_last();
return 0 if (!$self->next::method( $new_parent ));
$self->set_column(
- $self->position_column() => $self->search( {$self->_collection_clause()} )->count() + 1
+ $self->position_column() =>
+ $self->result_source->resultset->search(
+ {$self->_collection_clause()}
+ )->count() + 1
);
$self->update();
return 1;
sub children {
my( $self ) = @_;
- my $rs = $self->search(
+ my $rs = $self->result_source->resultset->search(
{ $self->parent_column() => $self->id() },
{ order_by => $self->position_column() }
);
These methods are used internally. You should never have the
need to use them.
+=head2 collection_column
+
+Postional's collection_column method does not, and should not, be
+defined when using this module. This method just throws out an
+error if you try to use it.
+
+=cut
+
+sub collection_column {
+ croak('Use parent_column() instead of collection_column()');
+}
+
=head2 _collection_clause
This method is provided as an override of the method in