/** * Save element structure to datasource * * @param \Grid\Banner\Model\Banner\Structure\ProxyAbstract $structure * @return int Number of affected rows */ public function save(&$structure) { if (!$structure instanceof Structure\ProxyAbstract || empty($structure->type)) { return 0; } $data = ArrayUtils::iteratorToArray($structure->getBaseIterator()); $result = parent::save($data); if ($result > 0) { if (empty($structure->id)) { $structure->setOption('id', $id = $data['id']); } else { $id = $structure->id; } foreach ($structure->getPropertiesIterator() as $property => $value) { $result += $this->saveProperty($id, $property, $value); } } return $result; }