Re: how to use transactions in cakephp

2011-01-14 Thread Larry E. Masters
Nice constructive criticism. You leave a  comment for the user who
submitted the video? I am sure he would take your suggestions and use
them for another video, he might even suggest you do one yourself and
submit it to help the community learn.

--
Larry E. Masters

On Jan 14, 2011, at 16:44, Ryan Schmidt  wrote:

>
> On Jan 12, 2011, at 04:58, Larry E. Masters wrote:
>
>> I just noticed this thread. You might want to look at a video someone 
>> uploaded to http://tv.cakephp.org recently showing how to use transactions 
>> with CakePHP
>>
>> http://tv.cakephp.org/video/guille1983/2011/01/10/database_transactions
>
> Unfortunately, it's a very rambling and slow video by someone whose accent 
> makes him very difficult to understand. And the examples could have been 
> better chosen to better illustrate the concepts.
>
> Not to mention that I had to turn my TV's volume up to its highest setting 
> before I could hear the audio, ensuring that at the end of the screencast, 
> Jamie Lee Curtis would scream at me at the top of her lungs asking why women 
> like me like Activia.
>
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to use transactions in cakephp

2011-01-14 Thread Ryan Schmidt

On Jan 12, 2011, at 04:58, Larry E. Masters wrote:

> I just noticed this thread. You might want to look at a video someone 
> uploaded to http://tv.cakephp.org recently showing how to use transactions 
> with CakePHP
> 
> http://tv.cakephp.org/video/guille1983/2011/01/10/database_transactions

Unfortunately, it's a very rambling and slow video by someone whose accent 
makes him very difficult to understand. And the examples could have been better 
chosen to better illustrate the concepts.

Not to mention that I had to turn my TV's volume up to its highest setting 
before I could hear the audio, ensuring that at the end of the screencast, 
Jamie Lee Curtis would scream at me at the top of her lungs asking why women 
like me like Activia.



Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to use transactions in cakephp

2011-01-13 Thread huoxito
yeah, i'll take a look at that .., thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to use transactions in cakephp

2011-01-12 Thread Zeu5
Thank you for the update PhpNut :)

On Jan 12, 6:58 pm, "Larry E. Masters"  wrote:
> I just noticed this thread. You might want to look at a video someone
> uploaded tohttp://tv.cakephp.orgrecently showing how to use transactions
> with CakePHP
>
> http://tv.cakephp.org/video/guille1983/2011/01/10/database_transactions
>
> --
> Larry E. Masters
>
>
>
>
>
>
>
> On Tue, Jan 11, 2011 at 11:44 PM, huoxito  wrote:
> > great topic, just helped me alot here, thanks! so good cake got this group!
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to use transactions in cakephp

2011-01-12 Thread Larry E. Masters
I just noticed this thread. You might want to look at a video someone
uploaded to http://tv.cakephp.org recently showing how to use transactions
with CakePHP

http://tv.cakephp.org/video/guille1983/2011/01/10/database_transactions

-- 
Larry E. Masters


On Tue, Jan 11, 2011 at 11:44 PM, huoxito  wrote:

> great topic, just helped me alot here, thanks! so good cake got this group!
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to use transactions in cakephp

2011-01-11 Thread huoxito
great topic, just helped me alot here, thanks! so good cake got this group!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to use transactions in cakephp

2010-12-24 Thread Zeu5
Hi Amit,

it worked. Thank you very much.

Saw your website. Interesting.

Apparently i had previously added you to my watchlist for providers
who appear to be experienced in cakephp.

Perhaps next time when i seek major help in cakephp, i will consider
your company more. :)

Have a good weekend.

On Dec 24, 4:31 pm, Amit Badkas  wrote:
> Hi,
>
> I didn't know that you need to use saveAll() inside transaction. By default,
> saveAll() starts new transaction. So change your saveAll() call from
>
> $result = $this->saveAll($data);
>
> to
>
> $result = $this->saveAll($data, array('atomic' => false));
>
> Hope this helps.
>
> Amit Badkas
>
> PHP Applications for E-Biz:http://www.sanisoft.com
>
>
>
>
>
>
>
> On Fri, Dec 24, 2010 at 1:30 PM, Zeu5  wrote:
> > Hi all,
>
> > it did not work.
>
> > I have tried
>
> > This is for a Merchant Model;
>
> > $datasource = $this->getDataSource();
>
> > $datasource->begin($this);
>
> > $result = $this->saveAll($data);
> > if (!$result) {
> >  $datasource->rollback($this);
> >  return false;
> > }
> > /**
> > * do something to form a $domainData array
> > **/
> > $result = $this->Shop->Domain->save($domainData);
>
> > if (!$result) {
> >  $datasource->rollback($this);
> >  return false;
> > }
>
> > // and so on.
>
> > // finally the last one has
>
> > if (!$result) {
> >  $datasource->rollback($this);
> >  return false;
> > } else {
> >  $datasource->commit($this);
> > }
>
> > There is no single transaction to speak of. because if i purposely
> > fail the last save() or saveAll(). the previous save and saveAll will
> > work.
>
> > Please advise.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to use transactions in cakephp

2010-12-24 Thread Zeu5
Thanks for the tip Amit.

I shall go try that.

Any idea why i cannot subscribe to this particular thread via my
gmail?

On Dec 24, 4:31 pm, Amit Badkas  wrote:
> Hi,
>
> I didn't know that you need to use saveAll() inside transaction. By default,
> saveAll() starts new transaction. So change your saveAll() call from
>
> $result = $this->saveAll($data);
>
> to
>
> $result = $this->saveAll($data, array('atomic' => false));
>
> Hope this helps.
>
> Amit Badkas
>
> PHP Applications for E-Biz:http://www.sanisoft.com
>
>
>
>
>
>
>
> On Fri, Dec 24, 2010 at 1:30 PM, Zeu5  wrote:
> > Hi all,
>
> > it did not work.
>
> > I have tried
>
> > This is for a Merchant Model;
>
> > $datasource = $this->getDataSource();
>
> > $datasource->begin($this);
>
> > $result = $this->saveAll($data);
> > if (!$result) {
> >  $datasource->rollback($this);
> >  return false;
> > }
> > /**
> > * do something to form a $domainData array
> > **/
> > $result = $this->Shop->Domain->save($domainData);
>
> > if (!$result) {
> >  $datasource->rollback($this);
> >  return false;
> > }
>
> > // and so on.
>
> > // finally the last one has
>
> > if (!$result) {
> >  $datasource->rollback($this);
> >  return false;
> > } else {
> >  $datasource->commit($this);
> > }
>
> > There is no single transaction to speak of. because if i purposely
> > fail the last save() or saveAll(). the previous save and saveAll will
> > work.
>
> > Please advise.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to use transactions in cakephp

2010-12-24 Thread Amit Badkas
Hi,

I didn't know that you need to use saveAll() inside transaction. By default,
saveAll() starts new transaction. So change your saveAll() call from

$result = $this->saveAll($data);

to

$result = $this->saveAll($data, array('atomic' => false));

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Dec 24, 2010 at 1:30 PM, Zeu5  wrote:

> Hi all,
>
> it did not work.
>
> I have tried
>
> This is for a Merchant Model;
>
> $datasource = $this->getDataSource();
>
> $datasource->begin($this);
>
> $result = $this->saveAll($data);
> if (!$result) {
>  $datasource->rollback($this);
>  return false;
> }
> /**
> * do something to form a $domainData array
> **/
> $result = $this->Shop->Domain->save($domainData);
>
> if (!$result) {
>  $datasource->rollback($this);
>  return false;
> }
>
> // and so on.
>
> // finally the last one has
>
> if (!$result) {
>  $datasource->rollback($this);
>  return false;
> } else {
>  $datasource->commit($this);
> }
>
>
> There is no single transaction to speak of. because if i purposely
> fail the last save() or saveAll(). the previous save and saveAll will
> work.
>
> Please advise.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to use transactions in cakephp

2010-12-24 Thread Zeu5
Hi all,

it did not work.

I have tried

This is for a Merchant Model;

$datasource = $this->getDataSource();

$datasource->begin($this);

$result = $this->saveAll($data);
if (!$result) {
  $datasource->rollback($this);
  return false;
}
/**
* do something to form a $domainData array
**/
$result = $this->Shop->Domain->save($domainData);

if (!$result) {
  $datasource->rollback($this);
  return false;
}

// and so on.

// finally the last one has

if (!$result) {
  $datasource->rollback($this);
  return false;
} else {
 $datasource->commit($this);
}


There is no single transaction to speak of. because if i purposely
fail the last save() or saveAll(). the previous save and saveAll will
work.

Please advise.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to use transactions in cakephp

2010-12-23 Thread Amit Badkas
Hi,

I would use something like following in one of the models to save data for
non-related InnoDB tables

$db =& ConnectionManager::getDataSource($this->useDbConfig);
$db->begin($this);



$db->commit($this);

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Dec 23, 2010 at 7:46 PM, Zeu5  wrote:

> Alright thanks!
>
> On Dec 23, 8:55 pm, Jon Bennett  wrote:
> > > Unfortunately the 7 models are not interrelated to each other, some
> > > are of course related.
> >
> > > So i am not sure if saveAll allows that non interrelated models.
> >
> > I've only used transactions in cake to save related data, though I
> > believe once a transaction has been triggered, it will wrap any
> > subsequent saveAll's as well - not certain on that, worth checking!
> >
> > not used the datasource way of doing it, sorry.
> >
> > hth
> >
> > Jo
> >
> > --
> > jon bennett -www.jben.net- blog.jben.net
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to use transactions in cakephp

2010-12-23 Thread Zeu5
Alright thanks!

On Dec 23, 8:55 pm, Jon Bennett  wrote:
> > Unfortunately the 7 models are not interrelated to each other, some
> > are of course related.
>
> > So i am not sure if saveAll allows that non interrelated models.
>
> I've only used transactions in cake to save related data, though I
> believe once a transaction has been triggered, it will wrap any
> subsequent saveAll's as well - not certain on that, worth checking!
>
> not used the datasource way of doing it, sorry.
>
> hth
>
> Jo
>
> --
> jon bennett -www.jben.net- blog.jben.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to use transactions in cakephp

2010-12-23 Thread Jon Bennett
> Unfortunately the 7 models are not interrelated to each other, some
> are of course related.
>
> So i am not sure if saveAll allows that non interrelated models.

I've only used transactions in cake to save related data, though I
believe once a transaction has been triggered, it will wrap any
subsequent saveAll's as well - not certain on that, worth checking!

not used the datasource way of doing it, sorry.

hth

Jo

-- 
jon bennett - www.jben.net - blog.jben.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to use transactions in cakephp

2010-12-23 Thread Zeu5
Hi Jon

> Use innodb and connect your keys/tables correctly.
> Use saveAll not save and it will wrap all the SQL into a single transaction.

Are you suggesting an alternative to 
http://book.cakephp.org/view/1633/Transactions
?

Unfortunately the 7 models are not interrelated to each other, some
are of course related.

So i am not sure if saveAll allows that non interrelated models.

Thank you.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to use transactions in cakephp

2010-12-23 Thread Jon Bennett
> i have a 7 model transaction that needs to be rolled back whenever 1
> of the tables do not commit properly.
>
> i found this but i am not sure how it works.
>
> http://book.cakephp.org/view/1633/Transactions
>
> I am vaguely familiar with MySQL transaction but prefer to follow cake
> way of doing things.

Use innodb and connect your keys/tables correctly.
Use saveAll not save and it will wrap all the SQL into a single transaction.

hth

Jon

-- 
jon bennett - www.jben.net - blog.jben.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en