PHP code example of bpzr / entity-adapter

1. Go to this page and download the library: Download bpzr/entity-adapter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bpzr / entity-adapter example snippets


/** @return array<int, ProductEntity> ID => product */
public function findProductsByIds(array $productIds): array
{
    return $this->entityAdapter->createAll(
        ProductEntity::class,
        $this->connection->executeQuery('SELECT * FROM product WHERE id IN (?)', [$productIds], [ArrayParameterType::INTEGER]),
        [ProductEntity::class, 'getId'],
    );
}