Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 586fd746814f65a7af37e95a8e61d5e3ac2e604a 1 parent 204b797
@coogle authored
Showing with 9 additions and 4 deletions.
  1. +7 −2 data/Collection.php
  2. +2 −2 data/Entity.php
View
9 data/Collection.php
@@ -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
4 data/Entity.php
@@ -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);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.