Questions tagged [yii-cmodel]

CModel is one the basic classes of the yii framework for data model objects.

CModel is one the basic classes of the framework for data model objects.

CModel is the base class providing the common features needed by data model objects.

CModel defines the basic framework for data models that need to be validated.

Read more: http://www.yiiframework.com/doc/api/1.1/CModel

59 questions
1
vote
1 answer

Implementing a custom getter in Yii?

I am working with Yii and I have the following situation: I have a MySQL table: charges { id INT AUTOINCREMENT, name VARCHAR(256), value DOUBLE } Then I have the model from this table. And finally I have the views for create, list,…
ivantxo
  • 719
  • 5
  • 18
  • 36
1
vote
5 answers

Yii Models: Using dynamic table name in a Yii model

I have a Yii model that will be using (later) multiple databases and the table prefix will be based on a code. For example: AMI_tablename, BMI_ AMI_tablename etc These all tables are same but in different databases. I want to know how could I…
Arfeen
  • 2,553
  • 5
  • 29
  • 48
0
votes
3 answers

Track CreatedBy and UpdatedBy in Yii

I have the database like this === Group === id member_id decsription === Member === id name description Everything is working fine.Now I extended my Group table and added some extra field like created_by and updated_by,by which I can track who has…
NewUser
  • 12,713
  • 39
  • 142
  • 236
0
votes
1 answer

Yii, Multiple MANY_MANY relations

Ok so i have two models: 1: pv_array (photovoltaic array) 2: module (photovoltaic module) there is a MANY_MANY relation between both of them: return array( 'modules' => array(self::MANY_MANY, 'module',…
AndrewMcLagan
  • 13,459
  • 23
  • 91
  • 158
0
votes
1 answer

Getting error in Yii Multimodel Form

I am a newbie to the Yii framework.I want a multimodel form so I just went through this link and made all things like this.I have two table, first is group and another is member. Group ID name Member id group_id firstname lastname Now I…
Jagdish
  • 259
  • 1
  • 8
  • 19
0
votes
1 answer

How to edit validation rules dynamically in Yii

I have a validation rules in my model: public function rules() { return array(){ array('order', 'required'), } } I have an input text element in my order view: input type="text" name="order1" when I press a button, my input text element…
0
votes
1 answer

Forms with related models

I'm facing a problem with a site I'm building using the Yii framework. In the site I have a form for the Photos model. The Photos model is related to the Stores model like so: Stores Model public function relations() { return array( 'photos' =>…
Donnie Thomas
  • 3,888
  • 8
  • 47
  • 70
0
votes
2 answers

Problem in Saving Multi Level Models in YII

My Table structure for user and his adress detail is as follows CREATE TABLE tbl_users ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, loginname varchar(128) NOT NULL, enabled enum("True","False"), approved enum("True","False"), …
Mohd Viqar
  • 258
  • 2
  • 5
  • 11
0
votes
1 answer

Saving 'model attributes' not working (need help)

I just found a problem with my project. It's simply not saving data in database. I couldn't find where is the problem, so please help to solve this problem. my controller codes public function actionCreate() { $model = new Ideyalar; //…
Mirjalal
  • 57
  • 1
  • 9
0
votes
2 answers

Yii - Sort Error while using Join query in CDbCriteria with CActiveDataProvider

Model Search Method $criteria->alias = 'c'; $criteria->select = 'c.*,max(ca.date) AS lastactivity'; $criteria->join = 'LEFT JOIN tbl_contact_action AS ca ON (ca.contact_id=c.contact_id)'; $criteria->condition = 'c.status<>"Deleted"'; …
Mihir Patel
  • 230
  • 4
  • 22
0
votes
2 answers

Rendering models using YII without a DB table

I'd like to render a list of results in a view which have been returned from an external API, rather than a database table. It is possible to create temporary models for the data and display through a data provider? The data is from Zoopla's API…
sc4490
  • 11
  • 2
0
votes
2 answers

In the Yii framework how is the situation handled where 2 independant models are to be called in a single view?

I am a Yii newbie who is trying to understand how this particular situation would be handled. If I have 2 models, The first model contains date and other information pertaining to the model. The second model contains date and information pertaining…
joe
  • 31
  • 4
0
votes
1 answer

Yii redirect on a particular validation fail

I have this validation rule in an user table that makes sure user email is unique. Now I don't want to skip this validation, but want to give an option to the user to choose the existing user data and insert relevant data to another relation table.…
redGREENblue
  • 3,076
  • 8
  • 39
  • 57
0
votes
2 answers

Yii model not getting posted

I have this weird issue where the values seems to get posted on form submit but still there the controller seems to not find it. I am saving three models with a single form. Both the relations to the main model are HAS_MANY. Here's the…
redGREENblue
  • 3,076
  • 8
  • 39
  • 57
0
votes
1 answer

Yii populate a dropdown on select of another

I have a dropdown that I want to populate when an item in another dropdown is selected. Both the dropdown are tied to data/model passed on from controller. and the first dropdown is populated from DB by calling a function in the model. Heres' the…
redGREENblue
  • 3,076
  • 8
  • 39
  • 57