Commit 696a3695 authored by Dirk Wildt's avatar Dirk Wildt

0.0.6

parent a5e3974f
......@@ -66,6 +66,12 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
*/
protected $groupRepository = null;
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager
* @inject
*/
protected $persistenceManager;
/**
* ticketRepository
*
......
This diff is collapsed.
......@@ -56,9 +56,11 @@ class Cell extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* txTileGroup
*
* @var \Netzmacher\Tile\Domain\Model\Group
* @todo check lazy, check cascade remove
*/
protected $txTileGroup = null;
/**
* txTileTicket
*
......@@ -238,6 +240,16 @@ class Cell extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
return $this->txTileArea;
}
/**
* Removes a Group
*
* @return void
*/
public function removeTxTileGroup( )
{
$this->txTileGroup = null;
}
/**
* Sets the txTileArea
*
......@@ -265,15 +277,16 @@ class Cell extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param int
* @return void
*/
public function setTxTileCategory( $category )
public function setTxTileCategory( $categoryUid )
{
$this->txTileCategory = $category;
$this->txTileCategory = $categoryUid;
}
/**
* Returns the txTileGroup
*
* @return \Netzmacher\Tile\Domain\Model\Group txTileGroup
*
* @return \Netzmacher\Tile\Domain\Model\Group $txTileGroup
*/
public function getTxTileGroup()
{
......@@ -307,9 +320,9 @@ class Cell extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param int
* @return int
*/
public function setTxTileTicket( $ticket )
public function setTxTileTicket( $ticketUid )
{
$this->txTileTicket = $ticket;
$this->txTileTicket = $ticketUid;
}
}
......@@ -32,36 +32,9 @@ class Group extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* txTileCell
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Netzmacher\Tile\Domain\Model\Cell>
* @var int
*/
protected $txTileCell = null;
/**
* txTileCategory
*
* @var \Netzmacher\Tile\Domain\Model\Category
*/
protected $txTileCategory = null;
/**
* __construct
*/
public function __construct()
{
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Initializes all ObjectStorage properties
*
* @return void
*/
protected function initStorageObjects()
{
$this->txTileCell = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
protected $txTileCell = '';
/**
* Returns the title
......@@ -84,32 +57,10 @@ class Group extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
$this->title = $title;
}
/**
* Adds a Cell
*
* @param \Netzmacher\Tile\Domain\Model\Cell $txTileCell
* @return void
*/
public function addTxTileCell( \Netzmacher\Tile\Domain\Model\Cell $txTileCell )
{
$this->txTileCell->attach( $txTileCell );
}
/**
* Removes a Cell
*
* @param \Netzmacher\Tile\Domain\Model\Cell $txTileCellToRemove The Cell to be removed
* @return void
*/
public function removeTxTileCell( \Netzmacher\Tile\Domain\Model\Cell $txTileCellToRemove )
{
$this->txTileCell->detach( $txTileCellToRemove );
}
/**
* Returns the txTileCell
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Netzmacher\Tile\Domain\Model\Cell> $txTileCell
* @return int $txTileCell
*/
public function getTxTileCell()
{
......@@ -119,33 +70,12 @@ class Group extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Sets the txTileCell
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Netzmacher\Tile\Domain\Model\Cell> $txTileCell
* @param int $txTileCell
* @return void
*/
public function setTxTileCell( \TYPO3\CMS\Extbase\Persistence\ObjectStorage $txTileCell )
public function setTxTileCell( $txTileCell )
{
$this->txTileCell = $txTileCell;
}
/**
* Returns the txTileCategory
*
* @return \Netzmacher\Tile\Domain\Model\Category $txTileCategory
*/
public function getTxTileCategory()
{
return $this->txTileCategory;
}
/**
* Sets the txTileCategory
*
* @param \Netzmacher\Tile\Domain\Model\Category $txTileCategory
* @return void
*/
public function setTxTileCategory( \Netzmacher\Tile\Domain\Model\Category $txTileCategory )
{
$this->txTileCategory = $txTileCategory;
}
}
......@@ -4,7 +4,6 @@ namespace Netzmacher\Tile\Domain\Repository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Connection;
/* * *
*
......@@ -24,14 +23,47 @@ class CellRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
/**
* @param \Netzmacher\Tile\Domain\Model\Group $group
* @param array
* @return array
* @version 0.0.5
* @version 0.0.6
* @since 0.0.5
* @internal #t3749
*/
public function getCellsByXyRange( $xyRange ): array
public function getCellsByGroup( \Netzmacher\Tile\Domain\Model\Group $group ): array
{
$rows = [];
$queryBuilder = GeneralUtility::makeInstance( ConnectionPool::class )->getConnectionForTable( 'tx_tile_domain_model_cell' )->createQueryBuilder();
$queryBuilder
->select( 'uid' )
->from( 'tx_tile_domain_model_cell' )
->where(
$queryBuilder->expr()->eq( 'tx_tile_group', $queryBuilder->createNamedParameter( $group->getUid() ) )
)
;
$result = $queryBuilder->execute();
while( $row = $result->fetch() )
{
$rows[] = $row[ 'uid' ];
}
return $rows;
}
/**
* @param \Netzmacher\Tile\Domain\Model\Cell $cell
* @param array
* @return array
* @version 0.0.6
* @since 0.0.5
* @internal #t3749
*/
public function getCellsByXyRange( \Netzmacher\Tile\Domain\Model\Cell $cell, $xyRange ): array
{
// var_dump( __METHOD__, __LINE__, $cell->getTxTileArea()->getTitle() );
// die();
$rows = [];
$queryBuilder = GeneralUtility::makeInstance( ConnectionPool::class )->getConnectionForTable( 'tx_tile_domain_model_cell' )->createQueryBuilder();
$queryBuilder
......@@ -42,17 +74,16 @@ class CellRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
, $queryBuilder->expr()->lte( 'x', $queryBuilder->createNamedParameter( $xyRange[ 'maxX' ] ) )
, $queryBuilder->expr()->gte( 'y', $queryBuilder->createNamedParameter( $xyRange[ 'minY' ] ) )
, $queryBuilder->expr()->lte( 'y', $queryBuilder->createNamedParameter( $xyRange[ 'maxY' ] ) )
, $queryBuilder->expr()->eq( 'tx_tile_area', $queryBuilder->createNamedParameter( $cell->getTxTileArea()->getUid() ) )
)
;
$result = $queryBuilder->execute();
while( $row = $result->fetch() )
{
$rows[] = $row['uid'];
$rows[] = $row[ 'uid' ];
}
// var_dump( __METHOD__, __LINE__, serialize( $result ), $rows );
// die();
return $rows;
}
......
......@@ -22,24 +22,4 @@ namespace Netzmacher\Tile\Domain\Repository;
*/
class CssRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
// /**
// * @param int $uid
// * @return string
// * @version 0.0.3
// * @since 0.0.3
// */
// public function getCssClassByUid( $uid ): string
// {
// $class = '';
// $query = $this->createQuery();
// $sql = 'select uid,title from pages where uid = ' . ( int ) $uid . ' limit 1';
// $result = $query->statement( $sql )->execute( true );
// if( !empty( $result[ 0 ][ 'title' ] ) )
// {
// $class = $result[ 0 ][ 'title' ];
// }
// return $class;
// }
}
......@@ -236,7 +236,7 @@ return [
],
'minitems' => 0,
'maxitems' => 1,
'readOnly' => 1,
'readOnly' => 0,
],
],
'tx_tile_ticket' => [
......
......@@ -28,7 +28,10 @@ return [
'showRecordFieldList' => ''
. 'sys_language_uid, l10n_parent, l10n_diffsource,'
// . 'hidden,'
. 'title, tx_tile_cell, tx_tile_ticket',
. 'title, '
. 'tx_tile_cell, '
// . 'tx_tile_ticket'
,
],
'types' => [
'1' => [
......@@ -36,7 +39,9 @@ return [
. ' promptReadonly,'
// . ' sys_language_uid, l10n_parent, l10n_diffsource, '
// . ' hidden, '
. ' title, tx_tile_cell, tx_tile_ticket'
. ' title,'
. ' tx_tile_cell,'
// . ' tx_tile_ticket'
// . '--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,'
// . ' starttime, endtime'
],
......@@ -158,7 +163,8 @@ return [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'tx_tile_domain_model_cell',
'MM' => 'tx_tile_group_cell_mm',
'foreign_field' => 'tx_tile_group',
// 'MM' => 'tx_tile_group_cell_mm',
'size' => 10,
'autoSizeMax' => 30,
'maxitems' => 9999,
......@@ -177,17 +183,17 @@ return [
// 'readOnly' => 1,
],
],
'tx_tile_ticket' => [
'exclude' => true,
'label' => 'LLL:EXT:tile/Resources/Private/Language/locallang_db.xlf:tx_tile_domain_model_group.tx_tile_ticket',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'tx_tile_domain_model_ticket',
'minitems' => 0,
'maxitems' => 1,
// 'readOnly' => 1,
],
],
// 'tx_tile_ticket' => [
// 'exclude' => true,
// 'label' => 'LLL:EXT:tile/Resources/Private/Language/locallang_db.xlf:tx_tile_domain_model_group.tx_tile_ticket',
// 'config' => [
// 'type' => 'select',
// 'renderType' => 'selectSingle',
// 'foreign_table' => 'tx_tile_domain_model_ticket',
// 'minitems' => 0,
// 'maxitems' => 1,
//// 'readOnly' => 1,
// ],
// ],
],
];
......@@ -247,19 +247,4 @@ CREATE TABLE tx_tile_domain_model_ticket (
-- Next lines for compatibility TYPO3 8.7
PRIMARY KEY (uid),
KEY parent (pid)
);
#
# Table structure for table 'tx_tile_group_cell_mm'
#
CREATE TABLE tx_tile_group_cell_mm (
uid_local int(11) unsigned DEFAULT '0' NOT NULL,
uid_foreign int(11) unsigned DEFAULT '0' NOT NULL,
sorting int(11) unsigned DEFAULT '0' NOT NULL,
sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (uid_local,uid_foreign),
KEY uid_local (uid_local),
KEY uid_foreign (uid_foreign)
);
\ No newline at end of file
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