Skip to content

Commit

Permalink
Fetch item class for each row of the data
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 committed Sep 19, 2024
1 parent 492336f commit 9c073cc
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Common/BaseItemList.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,22 @@ protected function init(): void
{
}

/**
* Create list item from the given data
*
* @param object $data
*
* @return BaseListItem|BaseTableRowItem
*/
protected function createListItem(object $data)
{
return $this->getItemClass()($data, $this);

Check failure on line 74 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Trying to invoke string but it might not be a callable.

Check failure on line 74 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Trying to invoke string but it might not be a callable.

Check failure on line 74 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Trying to invoke string but it might not be a callable.

Check failure on line 74 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Trying to invoke string but it might not be a callable.

Check failure on line 74 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Trying to invoke string but it might not be a callable.

Check failure on line 74 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Trying to invoke string but it might not be a callable.

Check failure on line 74 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Trying to invoke string but it might not be a callable.
}

protected function assemble(): void
{
$itemClass = $this->getItemClass();
foreach ($this->data as $data) {
/** @var BaseListItem|BaseTableRowItem $item */
$item = new $itemClass($data, $this);
$item = $this->createListItem($data);

Check failure on line 80 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #1 $data of method ipl\Web\Common\BaseItemList::createListItem() expects object, mixed given.

Check failure on line 80 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #1 $data of method ipl\Web\Common\BaseItemList::createListItem() expects object, mixed given.

Check failure on line 80 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Parameter #1 $data of method ipl\Web\Common\BaseItemList::createListItem() expects object, mixed given.

Check failure on line 80 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Parameter #1 $data of method ipl\Web\Common\BaseItemList::createListItem() expects object, mixed given.

Check failure on line 80 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Parameter #1 $data of method ipl\Web\Common\BaseItemList::createListItem() expects object, mixed given.

Check failure on line 80 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Parameter #1 $data of method ipl\Web\Common\BaseItemList::createListItem() expects object, mixed given.

Check failure on line 80 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Parameter #1 $data of method ipl\Web\Common\BaseItemList::createListItem() expects object, mixed given.
$this->emit(self::BEFORE_ITEM_ADD, [$item, $data]);
$this->addHtml($item);
$this->emit(self::ON_ITEM_ADD, [$item, $data]);
Expand Down

0 comments on commit 9c073cc

Please sign in to comment.