Like CoughPHP?
Try LightVC, an MVC.

Minutes CoughPHP Developers Meeting

Austin, TX, September 23, 2008.

Present

Subject

Generated remove*() methods.

Issue

Currently the generated remove*() methods for generated classes that extend CoughObject do not behave in an intuitive way. They NULL out the related key, orphaning the data but not deleting it.

Discussion

We discussed removing the methods all together or switching to some acceptable behavior:

  1. Delete the data.
  2. “Retire” the data (e.g. toggle a flag or status column).
  3. Negate the ID (i.e. instead of NULLing it as is done now).

Resolution

We provide a deletion strategy option, settable through config. At minimum, we will provide (a) and (b) strategies already implemented out of box.

Many-to-many handling

Issue

Currently there is no explicit many-to-many handling. The methods must be written manually, or one must go through the generated join methods (think one-to-many-to-one).

Discussion

We talked about some of the reasons we moved away from the old CoughPHP behavior where these were once auto-detected and generated.

Resolution

We revive the behavior with these restrictions:

CoughObject::delete()

Issue

Currently CoughObject provides a public delete() method which falls outside of the “set, set, set, save” behavior because deletion happens immediately.

Discussion

We considered making a call to save() required after calling delete(). We did not like that because delete() flows with the already existing insert() and update() methods which also take effect immediately (those two methods are protected and save() decides which one to call).

Resolution

We introduce a new method called remove() which will mark the object for deletion (based on the deletion strategy in use). A call to save() will be required to make the delete effective. This name was chosen because it follows with the other add/remove methods which also require a save() call to take affect. We want to move delete() to a protected method like insert() and update() but will leave it public for one release. This will give users a chance to move their code over to the new way before it becomes protected.

Release and packaging

Issue

With the resolution for “Generated remove*() methods” we could not agree that CoughPHP should default in enterprise/safe mode (the flag/status column deletion strategy).

Discussion

We considered defaulting to “delete” behavior as many agreed that is the expected behavior to someone new to CoughPHP. But, we are also trying to push better practices in addition to preventing users from accidentally or unknowing deleting their (or their company’s) data.

Resolution

We provide a config option that must be set before the generator will continue. An message explaining how to set this will be given if the generator is run without this option set.

This entry was posted on Wednesday, September 24, 2008.