To update model properties just set them and call save () method. As well values that needed to by changed could be passed as an array to the save () method.
To update model properties just set them and call save () method. As well values that needed to by changed could be passed as an array to the save () method.
```php
```php
...
@@ -107,14 +115,14 @@ $user = user::byId (1);
...
@@ -107,14 +115,14 @@ $user = user::byId (1);
$user->save($data);
$user->save($data);
```
```
**[Delete]**
###Delete
Use delete() method on any loaded object.
Use delete() method on any loaded object.
```php
```php
$user=user::byId(1);
$user=user::byId(1);
$user->delete();
$user->delete();
```
```
**[Relations]**
###Relations
Currently dbObject supports only hasMany and hasOne relations only. To use them declare $relations array in the model class like:
Currently dbObject supports only hasMany and hasOne relations only. To use them declare $relations array in the model class like:
```php
```php
protected$relations=Array(
protected$relations=Array(
...
@@ -125,20 +133,18 @@ Currently dbObject supports only hasMany and hasOne relations only. To use them
...
@@ -125,20 +133,18 @@ Currently dbObject supports only hasMany and hasOne relations only. To use them
After that you can get related object via variables and do their modification/removal/display:
After that you can get related object via variables and do their modification/removal/display:
```php
```php
$user=user::byId(1);
$user=user::byId(1);
// sql: select * from $persontable where id = $personValue
// sql: select from $persontable where id = $personValue
echo$user->person->firstName." ".$user->person->lastName." have the following products:\n";
echo$user->person->firstName." ".$user->person->lastName." have the following products:\n";
// sql: select * from $product_table where userid = $userPrimaryKey
// sql: select from $product_table where userid = $userPrimaryKey