public function summaryTable(callable $summaryTableDefinitionCallback)
    {
        $definition = new SummaryTableDefinition($this, $this->class, $this->dataSource);

        $idField = Field::name(IReadModule::SUMMARY_TABLE_ID_COLUMN)->label('Id')
            ->int()
            ->required();

        if ($this->dataSource instanceof IRepository) {
            $definition->mapProperty(IEntity::ID)
                ->hidden()
                ->to($idField);
        } else {
            $definition
                ->mapCallback(function (ITypedObject $object) {
                    return $this->dataSource->getObjectId($object);
                })
                ->hidden()
                ->to($idField);
        }

        $this->eventDispatcher->emit(
            $this->packageName . '.' . $this->name . '.define-summary-table', $definition
        );

        $summaryTableDefinitionCallback($definition);

        $this->eventDispatcher->emit(
            $this->packageName . '.' . $this->name . '.defined-summary-table', $definition
        );

        $this->tables[IReadModule::SUMMARY_TABLE] = $this->summaryTable = $definition->finalize();
    }
public function summaryTable(callable $summaryTableDefinitionCallback)
    {
        $definition = new SummaryTableDefinition($this, $this->class, $this->dataSource);

        $idField = Field::name(IReadModule::SUMMARY_TABLE_ID_COLUMN)->label('Id')
            ->int()
            ->required();

        if ($this->dataSource instanceof IRepository) {
            $definition->mapProperty(IEntity::ID)
                ->hidden()
                ->to($idField);
        } else {
            $definition
                ->mapCallback(function (ITypedObject $object) {
                    return $this->dataSource->getObjectId($object);
                })
                ->hidden()
                ->to($idField);
        }

        $this->eventDispatcher->emit(
            $this->packageName . '.' . $this->name . '.define-summary-table', $definition
        );

        $summaryTableDefinitionCallback($definition);

        $this->eventDispatcher->emit(
            $this->packageName . '.' . $this->name . '.defined-summary-table', $definition
        );

        $this->tables[IReadModule::SUMMARY_TABLE] = $this->summaryTable = $definition->finalize();
    }
public function summaryTable ( callable $ summaryTableDefinitionCallback ) { $ definition = new SummaryTableDefinition ( $ this , $ this -> class , $ this -> dataSource ) ; $ idField = Field :: name ( IReadModule :: SUMMARY_TABLE_ID_COLUMN ) -> label ( 'Id' ) -> int ( ) -> required ( ) ; if ( $ this -> dataSource instanceof IRepository ) { $ definition -> mapProperty ( IEntity :: ID ) -> hidden ( ) -> to ( $ idField ) ; } else { $ definition -> mapCallback ( function ( ITypedObject $ object ) { return $ this -> dataSource -> getObjectId ( $ object ) ; } ) -> hidden ( ) -> to ( $ idField ) ; } $ this -> eventDispatcher -> emit ( $ this -> packageName . '.' . $ this -> name . '.define-summary-table' , $ definition ) ; $ summaryTableDefinitionCallback ( $ definition ) ; $ this -> eventDispatcher -> emit ( $ this -> packageName . '.' . $ this -> name . '.defined-summary-table' , $ definition ) ; $ this -> tables [ IReadModule :: SUMMARY_TABLE ] = $ this -> summaryTable = $ definition -> finalize ( ) ; }
Defines the structure of the summary table for the module.

Example:
<code>
$module->summaryTable(function (SummaryTableDefinition $table) {
$table->column(Column::name('name')->label('Name')->components([
Field::name('first_name')->label('First Name')->string(),
Field::name('last_name')->label('Last Name')->string(),
]));

$table->mapProperty('firstName')->toComponent('name.first_name');
$table->mapProperty('lastName')->toComponent('name.last_name');
$table->mapProperty('age')->to(Field::name('age')->label('Age')->int());
$table->mapProperty('ageSortIndex')->to(Field::name('age_sort_index')->label('Age')->int());

$table->view('default', 'Default')
->asDefault()
->loadAll()
->orderByAsc(['name.first_name', 'name.last_name']);

$table->view('category', 'Category')
->loadAll()
->groupBy('age')
->orderByAsc(['age', 'age_sort_index'])
->withReorder(function (Person $entity, $newOrderIndex) {
$this->repository->reorderPersonInAgeGroup($entity, $newOrderIndex);
});
});
</code>

@param callable $summaryTableDefinitionCallback

@throws InvalidArgumentException
@throws InvalidOperationException
Defines the structure of the summary table for the module .