Skip to content

Commit

Permalink
adding tree type and tree node type to export; import
Browse files Browse the repository at this point in the history
  • Loading branch information
aembler committed Sep 23, 2022
1 parent 369d9d7 commit e8fd29f
Show file tree
Hide file tree
Showing 26 changed files with 932 additions and 0 deletions.
21 changes: 21 additions & 0 deletions elements/batch_content_types/tree_node_type.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<table class="migration-table table table-bordered table-striped">
<thead>
<tr>
<th><?=t('Handle')?></th>
<th width="1"><input type="checkbox" data-checkbox="toggle-all"></th>
</tr>
</thead>
<tbody>
<?php foreach ($collection->getTypes() as $type) {
$validator = $type->getPublisherValidator();
?>
<tr <?php if ($validator->skipItem()) {
?>class="migration-item-skipped"<?php
}
?>>
<td><?=$type->getHandle()?></td>
<td><input data-checkbox="select-item" type="checkbox" name="item[thumbnail_type][]" value="<?=$type->getID()?>"></td>
<?php
} ?>
</tbody>
</table>
21 changes: 21 additions & 0 deletions elements/batch_content_types/tree_type.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<table class="migration-table table table-bordered table-striped">
<thead>
<tr>
<th><?=t('Handle')?></th>
<th width="1"><input type="checkbox" data-checkbox="toggle-all"></th>
</tr>
</thead>
<tbody>
<?php foreach ($collection->getTypes() as $type) {
$validator = $type->getPublisherValidator();
?>
<tr <?php if ($validator->skipItem()) {
?>class="migration-item-skipped"<?php
}
?>>
<td><?=$type->getHandle()?></td>
<td><input data-checkbox="select-item" type="checkbox" name="item[thumbnail_type][]" value="<?=$type->getID()?>"></td>
<?php
} ?>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
namespace PortlandLabs\Concrete5\MigrationTool\Batch\Formatter\ObjectCollection;

defined('C5_EXECUTE') or die("Access Denied.");

class TreeNodeTypeFormatter extends AbstractFormatter
{
public function getPluralDisplayName()
{
return t('Tree Node Types');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
namespace PortlandLabs\Concrete5\MigrationTool\Batch\Formatter\ObjectCollection;

defined('C5_EXECUTE') or die("Access Denied.");

class TreeTypeFormatter extends AbstractFormatter
{
public function getPluralDisplayName()
{
return t('Tree Types');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
namespace PortlandLabs\Concrete5\MigrationTool\Entity\Export;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
*/
class TreeNodeType extends AbstractStandardExportItem
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
namespace PortlandLabs\Concrete5\MigrationTool\Entity\Export;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
*/
class TreeType extends AbstractStandardExportItem
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?php
namespace PortlandLabs\Concrete5\MigrationTool\Entity\Import;

use PortlandLabs\Concrete5\MigrationTool\Publisher\Logger\LoggableInterface;
use PortlandLabs\Concrete5\MigrationTool\Publisher\PublishableInterface;
use PortlandLabs\Concrete5\MigrationTool\Publisher\Validator\BlockTypeValidator;
use Doctrine\ORM\Mapping as ORM;
use PortlandLabs\Concrete5\MigrationTool\Publisher\Validator\TreeNodeTypeValidator;

/**
* @ORM\Entity
* @ORM\Table(name="MigrationImportTreeNodeTypes")
*/
class TreeNodeType implements PublishableInterface, LoggableInterface
{
/**
* @ORM\Id @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;

/**
* @ORM\ManyToOne(targetEntity="\PortlandLabs\Concrete5\MigrationTool\Entity\Import\TreeNodeTypeObjectCollection")
**/
protected $collection;

/**
* @ORM\Column(type="string")
*/
protected $handle;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $package = null;

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @param mixed $id
*/
public function setId($id)
{
$this->id = $id;
}

/**
* @return mixed
*/
public function getCollection()
{
return $this->collection;
}

/**
* @param mixed $collection
*/
public function setCollection($collection)
{
$this->collection = $collection;
}

/**
* @return mixed
*/
public function getHandle()
{
return $this->handle;
}

/**
* @param mixed $handle
*/
public function setHandle($handle)
{
$this->handle = $handle;
}

/**
* @return mixed
*/
public function getPackage()
{
return $this->package;
}

/**
* @param mixed $package
*/
public function setPackage($package)
{
$this->package = $package;
}

public function getPublisherValidator()
{
return new TreeNodeTypeValidator($this);
}

public function createPublisherLogObject($publishedObject = null)
{
$type = new \PortlandLabs\Concrete5\MigrationTool\Entity\Publisher\Log\Object\BlockType();
$type->setHandle($this->getHandle());
return $type;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php
namespace PortlandLabs\Concrete5\MigrationTool\Entity\Import;

use Doctrine\Common\Collections\ArrayCollection;
use PortlandLabs\Concrete5\MigrationTool\Batch\BatchInterface;
use Doctrine\ORM\Mapping as ORM;
use PortlandLabs\Concrete5\MigrationTool\Batch\Formatter\ObjectCollection\TreeNodeTypeFormatter;

/**
* @ORM\Entity
*/
class TreeNodeTypeObjectCollection extends ObjectCollection
{
/**
* @ORM\OneToMany(targetEntity="\PortlandLabs\Concrete5\MigrationTool\Entity\Import\TreeNodeType", mappedBy="collection", cascade={"persist", "remove"})
**/
public $types;

public function __construct()
{
$this->types = new ArrayCollection();
}

/**
* @return ArrayCollection
*/
public function getTypes()
{
return $this->types;
}

public function getFormatter()
{
return new TreeNodeTypeFormatter($this);
}

public function getType()
{
return 'tree_node_type';
}

public function hasRecords()
{
return count($this->getTypes());
}

public function getRecords()
{
return $this->getTypes();
}

public function getTreeFormatter()
{
return false;
}

public function getRecordValidator(BatchInterface $batch)
{
return false;
}
}
112 changes: 112 additions & 0 deletions src/PortlandLabs/Concrete5/MigrationTool/Entity/Import/TreeType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?php
namespace PortlandLabs\Concrete5\MigrationTool\Entity\Import;

use PortlandLabs\Concrete5\MigrationTool\Publisher\Logger\LoggableInterface;
use PortlandLabs\Concrete5\MigrationTool\Publisher\PublishableInterface;
use Doctrine\ORM\Mapping as ORM;
use PortlandLabs\Concrete5\MigrationTool\Publisher\Validator\TreeTypeValidator;

/**
* @ORM\Entity
* @ORM\Table(name="MigrationImportTreeTypes")
*/
class TreeType implements PublishableInterface, LoggableInterface
{
/**
* @ORM\Id @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;

/**
* @ORM\ManyToOne(targetEntity="\PortlandLabs\Concrete5\MigrationTool\Entity\Import\TreeTypeObjectCollection")
**/
protected $collection;

/**
* @ORM\Column(type="string")
*/
protected $handle;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $package = null;

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @param mixed $id
*/
public function setId($id)
{
$this->id = $id;
}

/**
* @return mixed
*/
public function getCollection()
{
return $this->collection;
}

/**
* @param mixed $collection
*/
public function setCollection($collection)
{
$this->collection = $collection;
}

/**
* @return mixed
*/
public function getHandle()
{
return $this->handle;
}

/**
* @param mixed $handle
*/
public function setHandle($handle)
{
$this->handle = $handle;
}

/**
* @return mixed
*/
public function getPackage()
{
return $this->package;
}

/**
* @param mixed $package
*/
public function setPackage($package)
{
$this->package = $package;
}

public function getPublisherValidator()
{
return new TreeTypeValidator($this);
}

public function createPublisherLogObject($publishedObject = null)
{
$type = new \PortlandLabs\Concrete5\MigrationTool\Entity\Publisher\Log\Object\TreeType();
$type->setHandle($this->getHandle());
return $type;
}

}
Loading

0 comments on commit e8fd29f

Please sign in to comment.