Skip to content
This repository has been archived by the owner on Jun 20, 2018. It is now read-only.

Commit

Permalink
Updating readme
Browse files Browse the repository at this point in the history
  • Loading branch information
italolelis committed Nov 17, 2013
1 parent 8976ba0 commit 6235754
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Take a look and see what we're talking about!!
Installation
----------

`require: { "easyframework/collections": "2.1.*" }`
`require: { "easyframework/collections": "1.0.*" }`

`$ composer install`

Expand All @@ -27,7 +27,7 @@ Usage

The Collection represents the List in .NET language or simply non-associative arrays in php:

$collection = new \Easy\Collections\Collection();
$collection = new \Easy\Collections\ArrayList();
$collection->add('John');
$collection->add('Maria');
$collection->add('Anderson');
Expand Down Expand Up @@ -79,15 +79,15 @@ The Dictionary class is something like associative arrays in PHP, or Hash tables
When one key is inserted we can't insert the same key again, if we want to change its value we need to use the method set()
Here is an exemple of how we can get some item based on the key;

print_r ($dictionary->getItem('person1')); //returns array('name' => John, 'age' => 20)
print_r ($dictionary->get('person1')); //returns array('name' => John, 'age' => 20)

All Collection methods are also avaliable in Dictionary class, just remember to use each one in correct case, this will help you keep organization in your project.

### Working with objects ###

To our last exemple we'll use objects in our collection.

$collection = new \Easy\Collections\Collection();
$collection = new \Easy\Collections\ArrayList();
$collection->add(new Person('John', 20));
$collection->add(new Person('Peter', 20));
$collection->add(new Person('Sophie', 21));
Expand All @@ -103,7 +103,7 @@ Pretty simple, but the reason I wanted to show you objects is because of Express
Lets seek everyone with age 20.

$criteria = new \Easy\Collections\Criteria();
$expr = $criteria->expr()->eq("age", 20);
$expr = $criteria->createExpression()->eq("age", 20);
$criteria->where($expr);
$collection = $collection->matching($criteria);

Expand All @@ -115,7 +115,7 @@ Lets seek everyone with age 20.
Now we want everyone where the name starts with 'A'

$criteria = new \Easy\Collections\Criteria();
$expr = $criteria->expr()->contains("name", "A");
$expr = $criteria->createExpression()->contains("name", "A");
$criteria->where($expr);
$collection = $collection->matching($criteria);

Expand Down

0 comments on commit 6235754

Please sign in to comment.