Spot\Entity\Collection::add PHP 메소드

add() 공개 메소드

Add a single entity to the collection
public add ( object $entity )
$entity object to add
    public function add($entity)
    {
        $this->_results[] = $entity;
    }

Usage Example

예제 #1
0
파일: Collection.php 프로젝트: vlucas/spot
 public function testMergeIsNotUnique()
 {
     $collection2 = new \Spot\Entity\Collection();
     $this->collection->add(new Entity_Post(array('foo' => 'bar')));
     $collection2->add(new Entity_Post(array('foo' => 'bar')));
     $collection2->add(new Entity_Post());
     $collection2->merge($this->collection, false);
     $this->assertEquals(3, count($collection2));
 }