Skip to content

Instantly share code, notes, and snippets.

@c9s
Last active March 20, 2017 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c9s/595b27658d2dc2966198c226bb7457e8 to your computer and use it in GitHub Desktop.
Save c9s/595b27658d2dc2966198c226bb7457e8 to your computer and use it in GitHub Desktop.
<?php
/**
* An alias for BaseRepo::loadByKeys
*/
protected static function loadByKeys(array $args, $byKeys = null)
{
if (static::SHARD_MAPPING_ID) {
return static::shards()->first(function(BaseRepo $repo, Shard $shard) use ($arg, $byKeys) {
return $repo->loadByKeys($args, $byKeys);
});
}
return static::masterRepo()->loadByKeys($args, $byKeys);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment