2007-07-19 10:40:28 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2011-05-06 00:52:50 +10:00
|
|
|
* @deprecated Please use {@link DataList} or {@link ArrayList} instead.
|
2012-04-12 18:02:46 +12:00
|
|
|
* @package framework
|
2008-02-25 02:10:37 +00:00
|
|
|
* @subpackage model
|
2007-07-19 10:40:28 +00:00
|
|
|
*/
|
2011-05-06 00:52:50 +10:00
|
|
|
class DataObjectSet extends ArrayList {
|
2007-07-19 10:40:28 +00:00
|
|
|
|
2011-10-28 14:36:20 +13:00
|
|
|
/**
|
2011-10-29 12:02:11 +13:00
|
|
|
* @deprecated 3.0
|
2011-10-28 14:36:20 +13:00
|
|
|
*/
|
2011-05-06 00:52:50 +10:00
|
|
|
public function __construct($items = array()) {
|
2012-07-13 11:37:35 +02:00
|
|
|
Deprecation::notice('3.0', 'DataObjectSet is deprecated. Use DataList or ArrayList instead', Deprecation::SCOPE_CLASS);
|
2007-07-19 10:40:28 +00:00
|
|
|
|
2011-05-06 00:52:50 +10:00
|
|
|
if ($items) {
|
|
|
|
if (!is_array($items) || func_num_args() > 1) {
|
|
|
|
$items = func_get_args();
|
2007-07-19 10:40:28 +00:00
|
|
|
}
|
2007-09-14 17:59:33 +00:00
|
|
|
|
2011-05-06 00:52:50 +10:00
|
|
|
foreach ($items as $i => $item) {
|
|
|
|
if ($item instanceof ViewableData) {
|
|
|
|
continue;
|
2007-07-19 10:40:28 +00:00
|
|
|
}
|
2007-09-14 17:59:33 +00:00
|
|
|
|
2011-05-06 00:52:50 +10:00
|
|
|
if (is_object($item) || ArrayLib::is_associative($item)) {
|
|
|
|
$items[$i] = new ArrayData($item);
|
2007-07-19 10:40:28 +00:00
|
|
|
} else {
|
2011-05-06 00:52:50 +10:00
|
|
|
user_error(
|
|
|
|
"DataObjectSet::__construct: Passed item #{$i} is not an"
|
|
|
|
. ' and object or associative array, can\'t be properly'
|
|
|
|
. ' iterated on in templates', E_USER_WARNING
|
|
|
|
);
|
2007-07-19 10:40:28 +00:00
|
|
|
}
|
2007-09-14 17:59:33 +00:00
|
|
|
}
|
2010-12-11 05:43:08 +00:00
|
|
|
}
|
|
|
|
|
2011-05-06 00:52:50 +10:00
|
|
|
parent::__construct($items);
|
2008-03-11 01:31:43 +00:00
|
|
|
}
|
|
|
|
|
2012-03-24 16:04:52 +13:00
|
|
|
}
|