Skip to content

Commit

Permalink
changed in README
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Feb 15, 2014
1 parent cddecee commit 5c5ed1c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,19 @@ foreach ($post->comments as $comment) {
$comments = $db->comments->selectBy($post);
```

This allows make things like this:

```php
$post = $db->posts->selectBy(34);

$title = $post->comments->users->posts->title;

//Get the comments of the post
//Then the users related with these comments
//Then the posts created by these users
//And finally, the titles of all these posts
```

You can define the way of the lacy loads are executed, creating methods starting by "get" in the row class. The result of the method will be cached in the property.
Lacy loads not only works with relations, but also with any property you want. Just create a method named get[NameOfTheProperty] and that is all.

Expand Down Expand Up @@ -302,8 +315,6 @@ $post->comments; //Access to the cached result instead execute getComments() aga
$post->lowercaseTitle; //Execute getLowercaseTitle() and save the result in $post->lowercaseTitle;
```

Check the commented code to know full API.


#### Fields

Expand Down Expand Up @@ -409,3 +420,5 @@ return ($post->data instanceOf MyDataClass); //Return true
```

If you create a Field in your namespace with the same name than any of the defaults fields (Date, Datetime, Set, etc), SimpleCrud will choose your custom Field instead the default, so this is useful to overwrite the default behaviours.

Check the commented code to know full API.

0 comments on commit 5c5ed1c

Please sign in to comment.