Skip to content

Commit

Permalink
force the backend to inherit item class
Browse files Browse the repository at this point in the history
- Now each backend have to define an item class like repository case
because the name of the class is declared on the backend class, and now base
item class is abstract.
  • Loading branch information
marvil07 committed Jul 28, 2009
1 parent 30b6dbb commit e6f8735
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions includes/VersioncontrolItem.php
Expand Up @@ -35,7 +35,7 @@
* applicable. Most item revisions, but probably not all of them, are recorded
* in the database.
*/
class VersioncontrolItem implements ArrayAccess {
abstract class VersioncontrolItem implements ArrayAccess {
// Attributes
/**
* db identifier
Expand Down Expand Up @@ -544,7 +544,7 @@ public function getParentItem($parent_path = NULL) {
$revision = $this->revision;
}

$parent_item = new VersioncontrolItem(VERSIONCONTROL_ITEM_DIRECTORY,
$parent_item = new $this->repository->backend->classes['item'](VERSIONCONTROL_ITEM_DIRECTORY,
$path, $revision, NULL, $this->repository);

$parent_item->selected_label = new stdClass();
Expand Down
2 changes: 1 addition & 1 deletion includes/VersioncontrolOperation.php
Expand Up @@ -480,7 +480,7 @@ public function getItems($fetch_source_items = NULL) {
$this->vc_op_id, VERSIONCONTROL_OPERATION_MEMBER_ITEM);

while ($item_revision = db_fetch_object($result)) {
$items[$item_revision->path] = new VersioncontrolItem($item_revision->type, $item_revision->path, $item_revision->revision, NULL, $this->repository, NULL, $item_revision->item_revision_id);
$items[$item_revision->path] = new $this->repository->backend->classes['item']($item_revision->type, $item_revision->path, $item_revision->revision, NULL, $this->repository, NULL, $item_revision->item_revision_id);
$items[$item_revision->path]->selected_label = new stdClass();
$items[$item_revision->path]->selected_label->get_from = 'operation';
$items[$item_revision->path]->selected_label->operation = &$this;
Expand Down
4 changes: 4 additions & 0 deletions tests/versioncontrol_test.module
Expand Up @@ -32,6 +32,7 @@ class VersioncontrolTestBackend extends VersioncontrolBackend {
'repo' => 'VersioncontrolTestRepository',
'account' => 'VersioncontrolTestAccount',
'operation' => 'VersioncontrolTestOperation',
'item' => 'VersioncontrolTestItem',
);
}
}
Expand All @@ -44,3 +45,6 @@ class VersioncontrolTestAccount extends VersioncontrolAccount {

class VersioncontrolTestOperation extends VersioncontrolOperation {
}

class VersioncontrolTestItem extends VersioncontrolItem {
}
2 changes: 1 addition & 1 deletion versioncontrol.module
Expand Up @@ -1059,7 +1059,7 @@ function versioncontrol_fetch_source_items($repository, &$items) {
$items[$successor_key]->source_items = array();
}

$item = new VersioncontrolItem(
$item = new $repository->backend->classes['item'](
$item_revision->type,
$item_revision->path,
$item_revision->revision,
Expand Down

0 comments on commit e6f8735

Please sign in to comment.