echo "Loading $modelClass ";
$table = IPF_ORM::getTable($modelClass);
$table->getConnection()->beginTransaction();
+
+ $query = $table
+ ->createQuery()
+ ->limit(1);
+ foreach ($key as $k)
+ $query->addWhere($k . ' = ?');
+
foreach ($records as $record) {
- $query = $table
- ->createQuery()
- ->limit(1);
+ $params = array();
foreach ($key as $k)
- $query->addWhere($k . ' = ?', array($record[$k]));
+ $params[] = $record[$k];
- $model = $query->execute();
+ $model = $query->execute($params);
if ($model)
$model = $model[0];
else
function __construct($params=array())
{
+ $widget_attrs = ArrayTools::pop($params, 'widget_attrs', array());
+
$default = array();
foreach ($params as $key=>$in) {
- if ($key !== 'widget_attrs')
- if (isset($this->$key))
- $default[$key] = $this->$key;
+ if (isset($this->$key))
+ $default[$key] = $this->$key;
}
$m = array_merge($default, $params);
foreach ($params as $key=>$in) {
- if ($key !== 'widget_attrs')
- $this->$key = $m[$key];
+ $this->$key = $m[$key];
}
- $widget_attrs = isset($params['widget_attrs']) ? $params['widget_attrs'] : array();
$this->widget = $this->createWidget($widget_attrs);
}