Re: cakePHP and "Train Wrecks"

2006-07-17 Thread gwoo
decrement should be in the StockItem model and called with $this->Sale->StockItem->decrement(); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegr

Re: cakePHP and "Train Wrecks"

2006-07-17 Thread Sonic Baker
On 7/18/06, Gustavo Carreno <[EMAIL PROTECTED]> wrote: On 7/18/06, Sonic Baker <[EMAIL PROTECTED]> wrote:>>  addItem($item_id)>  {>  >  >  $this->Sale->StockItem->decrementStockItem($item_id); >  >  >  }Sale does not have any child class, it has a read() method thatreturns an ar

Re: cakePHP and "Train Wrecks"

2006-07-17 Thread Gustavo Carreno
On 7/18/06, Sonic Baker <[EMAIL PROTECTED]> wrote: > > addItem($item_id) > { > > > $this->Sale->StockItem->decrementStockItem($item_id); > > > } Sale does not have any child class, it has a read() method that returns an array of data, recordset alike, so you stop y

Re: cakePHP and "Train Wrecks"

2006-07-17 Thread Sonic Baker
Guys, thanks very much for your replies. I really value them. However, what if my methods are part of the model instead of the controller? e.g. If I had a 'Sale' model which contained a method 'addItem()' for adding an item to a Sale, which had something alone the lines of the folowing: addItem(

Re: cakePHP and "Train Wrecks"

2006-07-17 Thread Gustavo Carreno
On 7/17/06, nate <[EMAIL PROTECTED]> wrote: > (d) Use $uses to make Comment directly available, although this is > probably the least MVC-like Somehow I was made believe that you could access any model in the associations either directly or indirectly... Guess not :( -- Gustavo Carreno --- < If

Re: cakePHP and "Train Wrecks"

2006-07-16 Thread nate
You have to look at it in context. The article is providing a general rule of thumb for good object-oriented development, as evidenced by the very general code snippet representing a dog and it's tail. > This is known as a "Train Wreck". It said that this was bad because this one > line depends

Re: cakePHP and "Train Wrecks"

2006-07-16 Thread Gustavo Carreno
On 7/17/06, Sonic Baker <[EMAIL PROTECTED]> wrote: > Any comments will be greatly appreciated. You can access directly any of the models in the associations you've set. The QUOTE Train Wreck UNQUOTE scenario is just a means of readability. If you have Users hasMany Posts you can call $this->Post

cakePHP and "Train Wrecks"

2006-07-16 Thread Sonic Baker
Hi there, I've was reading an article (www.jmock.org/oopsla2004.pdf) the other day and came across an section in which there was a warning about code which goes along the lines of the following: dog.getBody().getTail().wag(); This is known as a "Train Wreck". It said that this w