Yii Framework Forum: How to save multiple records for single attribute - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to save multiple records for single attribute

#1 User is offline   gans 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 12-December 11

Posted 20 December 2011 - 03:43 AM

Hello Everyone,

I am new to Yii framework. I am using riak database.

I want to store multiple addresses(address,city,state,zip) for single user.

Rightnow my code is working for single address i.e single city,single state, single zip but when i try to save multiple addresses then it causes problem.

my code is :

protected function save(\CModel $model) {
if (empty($this->modelName))
$this->modelName = $this->modelClass;

if (isset($_POST[$this->modelName])) {
$model->attributes = $_POST[$this->modelName];
$modelsaved = $model->save();
}
}

Please help me out.

Thanks in advance.
0

#2 User is offline   andy_s 

  • Random Member Title
  • Yii
  • Group: Moderators
  • Posts: 1,526
  • Joined: 22-June 09
  • Location:Russia, Kostroma

Posted 21 December 2011 - 04:54 AM

Create a model for Addresses and use Tabular input.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users