PHP code example of harp-orm / identity-map
1. Go to this page and download the library: Download harp-orm/identity-map 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/ */
harp-orm / identity-map example snippets
$map = new IdentityMap(function ($item) {
return $item->getId();
});
$item1 = new Item(1);
$item2 = new Item(1);
$item3 = new Item(2);
echo $map->get($item1); // Will return item1
echo $map->get($item2); // Will return item1
echo $map->get($item3); // Will return item3