lithium\data\collection\DocumentSet::to PHP Method

to() public method

Adds conversions checks to ensure certain class types and embedded values are properly cast.
public to ( string $format, array $options = [] ) : mixed
$format string Currently only `array` is supported.
$options array
return mixed
    public function to($format, array $options = array())
    {
        $this->offsetGet(null);
        return parent::to($format, $options);
    }

Usage Example

Esempio n. 1
0
 public function testMap()
 {
     $collection = new DocumentSet();
     $collection->set(array('title' => 'Lorem Ipsum', 'key' => 'value', 'foo' => 'bar'));
     $results = $collection->map(function ($value) {
         return $value . ' test';
     });
     $expected = array('Lorem Ipsum test', 'value test', 'bar test');
     $this->assertEqual($results->to('array'), $expected);
     $this->assertNotEqual($results->to('array'), $collection->to('array'));
 }
All Usage Examples Of lithium\data\collection\DocumentSet::to