Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Apr 9, 2012
1 parent ca1bcb7 commit 5639812
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,32 +175,50 @@ To setup QueryDriver:

To create a model record:

```php
<?php
$author = new Author;
$author->create(array(
'name' => 'Foo'
));
```

Find record:

```php
<?php
$author->find(123);
$author->find(array( 'foo' => 'Name' ));
```

Find record with (static):

```php
<?php
$record = Author::load(array( 'name' => 'Foo' ));
```

Find record with primary key:

```php
<?php
$record = Author::load( 1 );
?>
```

Update record:

```php
<?php
$author->update(array(
'name' => 'Author',
));
```

Update record (static):

```php
<?php
$ret = Author::update( array( 'name' => 'Author' ) )
->where()
->equal('id',3)
Expand All @@ -212,10 +230,13 @@ Update record (static):
else {
echo $ret->exception->getMessage();
}
```

To create a collection object:

$authors = new Collection;
```php
<?php
$authors = new AuthorCollection;
$authors->where()
->equal( 'id' , 'foo' );

Expand All @@ -229,5 +250,6 @@ To create a collection object:
foreach( $authors as $author ) {
echo $author->name;
}

?>
```

0 comments on commit 5639812

Please sign in to comment.