Commit 9ffbeee3 authored by Dirk Wildt's avatar Dirk Wildt

0.0.6

parent 77c2d844
......@@ -136,13 +136,55 @@ class ShopController extends AbstractController
return $uid;
}
/**
* _cloneCellGroup
*
* @param int $groupUid
* @param int $pid
* @return mixed
* @version 0.0.6
* @since 0.0.6
* @internal #t3848
*/
private function _cloneCellGroup( $groupOrigUid, $pid )
{
static $groups = []; // originalUid => cloneUid
if( empty( $groupOrigUid ) )
{
return null;
}
if( in_array( $groupOrigUid, array_keys( $groups ) ) )
{
$groupCloneUid = $groups[ $groupOrigUid ];
return $this->groupRepository->findByUid( $groupCloneUid );
}
$groupOrig = $this->groupRepository->findByUid( $groupOrigUid );
$groupClone = new \Netzmacher\Tile\Domain\Model\Group;
$groupClone->_setProperty( 'pid', $pid );
$groupClone->setTitle( $groupOrig->getTitle() );
$groupClone->setTxTileCell( $groupOrig->getTxTileCell() );
$this->groupRepository->add( $groupClone );
$this->persistenceManager->persistAll();
$groupCloneUid = $groupClone->getUid();
$groups[ $groupOrigUid ] = $groupCloneUid;
//$this->addFlashMessage( __METHOD__ . ' (#' . __LINE__ . '): Group added with uid (#' . $groupCloneUid . ')', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::WARNING );
return $this->groupRepository->findByUid( $groupCloneUid );
}
/**
* _cloneCells
*
* @param \Netzmacher\Tile\Domain\Model\Area $area
* @param int $pid
* @param int $cloneAreaUid
* @return int
* @return void
* @version 0.0.6
* @since 0.0.6
* @internal #t3845
......@@ -154,25 +196,44 @@ class ShopController extends AbstractController
{
$clone = new \Netzmacher\Tile\Domain\Model\Cell;
// uid, pid
unset( $properties[ 'uid' ] );
unset( $properties[ 'tx_tile_area' ] ); // neu machen!!!
unset( $properties[ 'tx_tile_group' ] ); // neu machen!!!
unset( $properties[ 'tx_tile_ticket' ] ); // neu machen!!!
$properties[ 'pid' ] = $pid;
$properties[ 'tx_tile_area' ] = $this->areaRepository->findByUid( $cloneAreaUid );
// Area
$clone->setTxTileArea( $this->areaRepository->findByUid( $cloneAreaUid ) );
unset( $properties[ 'tx_tile_area' ] );
// Category
$clone->setTxTileCategory( $properties[ 'tx_tile_category' ] );
unset( $properties[ 'tx_tile_category' ] );
// Group
$groupClone = $this->_cloneCellGroup( $properties[ 'tx_tile_group' ], $pid );
if( $groupClone )
{
$clone->setTxTileGroup( $groupClone );
}
unset( $properties[ 'tx_tile_group' ] );
// Ticket
$clone->setTxTileTicket( $properties[ 'tx_tile_ticket' ] );
unset( $properties[ 'tx_tile_ticket' ] );
// all other properties
foreach( $properties as $key => $value )
{
$clone->_setProperty( $key, $value );
}
$clone->setTxTileArea( $this->areaRepository->findByUid( $cloneAreaUid ) );
// var_dump( __METHOD__, __LINE__, $clone->getTxTileCategory( ) );
// die();
$this->cellRepository->add( $clone );
$this->addFlashMessage( __METHOD__ . ' (#' . __LINE__ . '): Cell with area uid: ' . $cloneAreaUid, '', \TYPO3\CMS\Core\Messaging\AbstractMessage::WARNING );
// $this->addFlashMessage( __METHOD__ . ' (#' . __LINE__ . '): Cell with area uid: ' . $cloneAreaUid, '', \TYPO3\CMS\Core\Messaging\AbstractMessage::WARNING );
// $this->persistenceManager->persistAll();
// $uid = $clone->getUid();
}
return $uid;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment