Permalink
Browse files

Modifying Collection and Entity so that you can pass in $options if y…

…ou so desire. This allows you to

for example pass in custom data handlers if desired for specific object handling when calling Entity->data()
  • Loading branch information...
1 parent 16969a8 commit 348231d897a1bd49d1d94dc10e77c4b9663f005d @coogle committed Dec 20, 2012
Showing with 9 additions and 4 deletions.
  1. +7 −2 data/Collection.php
  2. +2 −2 data/Entity.php
View
@@ -492,8 +492,13 @@ public function sort($field = 'id', array $options = array()) {
*
* @return array Returns the array value of the data in this `Collection`.
*/
- public function data() {
- return $this->to('array', array('indexed' => null));
+ public function data(array $options = array()) {
+ $defaults = array(
+ 'indexed' => null
+ );
+
+ $options += $defaults;
+ return $this->to('array', $options);
}
/**
View
@@ -218,11 +218,11 @@ public function set(array $data) {
* @param string $name Optionally included field name.
* @return mixed Entire data array if $name is empty, otherwise the value from the named field.
*/
- public function data($name = null) {
+ public function data($name = null, array $options = array()) {
if ($name) {
return $this->__get($name);
}
- return $this->to('array');
+ return $this->to('array', $options);
}
/**

0 comments on commit 348231d

Please sign in to comment.