Skip to content

Instantly share code, notes, and snippets.

@chanmix51
Last active September 28, 2015 03:48
Show Gist options
  • Save chanmix51/1380200 to your computer and use it in GitHub Desktop.
Save chanmix51/1380200 to your computer and use it in GitHub Desktop.
Retrieving model class instances
<?php
//...
$transformers = $database
->getConnection()
->getMapFor('YourDb\Online\PowerSupplyTransformer')
->findWhere('stock > $* and voltage = $*', array(5, 220));
foreach($transformers as $transformer)
{
printf("%s %s volt (%d in stock)\n",
$transformer->reference,
$transformer->voltage,
$transformer->stock
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment