Question with parent::beforeSave()

I understand that you have to first call parent::beforeSave() inside your beforeSave method to check if the parent returned true before proceeding (or something like that) but I have a question regarding this.

I have a model here (Content) and another model (Blog) that extends the Content model. Now I was running into a problem where it would fail saving to the Blog model because of errors saying that certain attributes were not defined in the Blog model, despite passing validation. Basically my code runs like this:




if($valid)

{

	if($content->save(false))

	{

		$content_id=Yii::app()->db->getLastInsertID();

		$blog->content_id=$content_id;

		if($blog->save(false)) {}

	}

}



I then realized that the attributes yii was complaining about were attributes from my Content model. After some more digging, I found out it was my beforeSave() method in my Content table that was causing problems. I was assigning some default values like date_created inside the beforeSave() function ($this->date_created=time()) for the Content table and since my Blog model also had its own beforeSave() method and I had parent::beforeSave() in there, it seems to be calling the Content beforeSave method before continuing, resulting in yii looking for variables like date_created in my Blog model. How would I remedy this? Remove the parent::beforeSave()?

I’m still learning yii and how mvc works and stuff so I hope someone can point me to the right direction. Thanks

Anyone?