I wrote a doctrine query builder to return all transactions by one card. So I call the $card variable in the other function and it throws:
Warning: Declaration of Service\SomeService::showFields(ShowMapper $showMapper, $card) should be compatible with Admin\AbstractAdmin::configureShowFields(ShowMapper $show)
As I ca't change syntax of this Admin Service or adding new instances I need a way out.
This is main function
protected function configureShowFields(ShowMapper $showMapper, $card->this throws an error, it can't be set here)
{
$transactions = $this->getTransactions($card);
...etc
and my doctrine query:
public function getTransactions(Card $card)
{
return $this->getTransactionRepository()
->createQueryBuilder('t')
->where('t.card = :card')
->setParameter('card', $card)
->orderBy(''desc')
->getQuery()
->getResult();
}
I tried:
public $cards;
public function __construct(Card $cards)
{
parent::__construct();
$this->cards = $cards;
}
$cards = $this->cards;
$transactions = $this->getTransactions($cards);
but it throws
Binding entities to query parameters only allowed for entities that have an identifier.