AR ext for logs in db, save of many_many and extra

Hi,

I did this extension for AR to save the user and timestamp when created, updated or deleted (logical delete) only when the table have those fields.

Also it covers the save of the MANY_MANY relation with the help of a little widget.

The widget works like this:




<?php 

$this->widget('application.extensions.FormState.FormState', array(

    'items'=>array(

	'relateds'=>array(

	       'relationName'=>array(false, 'relatedModelName'),

           ),

     )

));

?>



The "false" tells to the save of relation if it uses the first or not (second) of the fk attrib id.

Good enough? Helps?

Paul

PS:

ARExtended update with a little fix when deleting old relations and added Form model save (you have to add the 3rd param in FormState, the id of the parameter lists in the form model)

Hi, Paul!

Great ext, it helped me to solve MANY_MANY saving issue.

I noticed some strange thing. In line #131 there is an ‘emploee’ field:


$form = new $fld[1](array('employee'=>$this));

What is it?

Hello,

I’m glad it helps.

That is some junk from my project which I forgot do clean.

In fact I didn’t finish all the work. It is used for the scenario when you want to use CFormModel and need to validate. $employee is the model container in those models of mine.

Maybe a forth param will help with the name of that model and replacing ‘employee’ string with that parameter.

Maybe is a better solution??

Regards,

Paul