Skip to content

Commit

Permalink
Fixed remaining examples to work with new dataset.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralph Schindler committed Apr 12, 2012
1 parent 0c0a8ab commit 8382d3e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion example-06.php
Expand Up @@ -13,4 +13,4 @@

$name = $row['name'];
$name2 = $row->name;
assert_example_works($name == 'Bar Artist' && $name2 == 'Bar Artist');
assert_example_works($name == 'Linkin Park' && $name2 == 'Linkin Park');
4 changes: 3 additions & 1 deletion example-07.php
Expand Up @@ -10,10 +10,12 @@
'history' => 'This is the history'
));

$id = $artistTable->getLastInsertValue();

assert_example_works($result === 1, true);

$artistTable = new Zend\Db\TableGateway\TableGateway('artist', $adapter);
$rowset = $artistTable->select(array('id' => 3));
$rowset = $artistTable->select(array('id' => $id));
$row = $rowset->current();

$name = $row['name'];
Expand Down
2 changes: 1 addition & 1 deletion example-12.php
Expand Up @@ -16,7 +16,7 @@
$rowset = $artistTable->select(array('id' => 2));

// make sure all rows come back and RowGateway
$rowset->setRowObjectPrototype(new Zend\Db\RowGateway\RowGateway($artistTable, 'id'));
$rowset->setRowObjectPrototype(new Zend\Db\RowGateway\RowGateway('id', 'artist', $adapter));

$row = $rowset->current();

Expand Down
5 changes: 3 additions & 2 deletions example-14.php
Expand Up @@ -8,10 +8,11 @@

$artistTable = new TableGateway('artist', $adapter);
$rowset = $artistTable->select(function (Select $select) {
$select->where->like('name', 'Bar%');
$select->where->like('name', 'Link%');
});
$row = $rowset->current();

$name = $row['name'];
$name2 = $row->name;
assert_example_works($name == 'Bar Artist' && $name2 == 'Bar Artist');

assert_example_works($name == 'Linkin Park' && $name2 == 'Linkin Park');
13 changes: 11 additions & 2 deletions example-15.php
Expand Up @@ -10,7 +10,7 @@
$select = new Select;
$select->from('artist')
->join('album', 'artist.id = album.artist_id')
->where->like('artist.name', 'Foo%');
->where->like('artist.name', 'Brit%');

$statment = $adapter->createStatement();
$select->prepareStatement($adapter, $statment);
Expand All @@ -23,4 +23,13 @@
$albums[] = $row->title;
}

assert_example_works($albums == array('Foos First Album', 'Foos Second Album'));
assert_example_works(
$albums == array(
0 => '...Baby One More Time',
1 => 'Oops!... I Did It Again',
2 => 'Britney',
3 => 'In the Zone',
4 => 'Blackout',
5 => 'Circus',
6 => 'Femme Fatale',
));

0 comments on commit 8382d3e

Please sign in to comment.