http://www.symfony-project.org/plugins/tbDuplicateKeyPlugin
On Apr 1, 1:09 pm, Joshua <[email protected]> wrote: > No I disagree. The application should be able to provide this > assistance for me. I shouldn't have to make these checks in every > instance every time. That puts a lot of responsibility on the > developer and creates overhead. The whole point of a framework is to > provide that assistance so the developer doesn't need to worry about > these things. > > Autonumber has nothing to do with it. The ID was just for example sake > it can happen with any primary key value. > > There should be an config option at least to get around this problem. > Maybe an option in the schema. > > On Mar 25, 6:59 pm, Steve the Canuck <[email protected]> wrote: > > > I would suggest this comes down to application design and logic. > > > Your business logic should not be creating duplicates of SomeClass if > > the instance already exists. > > > You can do one of two things: > > > 1) Do a lookup to see if the key already exists > > 2) Add a try catch block around the statement and recover > > > Also consider using autonumber fields for your Id's, so you don't need > > to calculate them. > > > Steve > > > On Mar 25, 5:20 pm, Joshua <[email protected]> wrote: > > > > $SomeClass= new SomeClass(); > > > $SomeClass->setId($number); > > > $SomeClass->save(); > > > > In this example if column ID is unique and there is already a row with > > > ID $number then trying to save this object will get an SQL Insert > > > rejection and crap the page. > > > > Following this futher... > > > > foreach($numbers as $number) > > > { > > > $SomeClass= new SomeClass(); > > > $SomeClass->setId($number); > > > $SomeClass->save(); > > > > } > > > > In that example if one of the objects fails it will do a full stop and > > > you get an Oops page. > > > > Is there any way to get symfony to just skip over these failed cases > > > and continue loading? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
