Reply to All
Show messages
Messages
Inbox
Search
Login
1–10
…
21–30
31–40
41–50
51–60
…
101
PHP Wizards
From: Peter (BOUGHTONP)
20 Apr 2011 12:10
To: Ken (SHIELDSIT)
45 of 101
38393.45
In reply to
38393.42
When you strip away all the crap, OO itself isn't that bad. (Though it's also
not
the One True Path.)
It's all the unnecessary over-complicated crap, like ORM and silly design patterns and so on, that makes it seem scary.
From: steve
20 Apr 2011 12:15
To: af (CAER)
46 of 101
38393.46
In reply to
38393.44
That looks even more complicated
:$
From: Peter (BOUGHTONP)
20 Apr 2011 12:16
To: af (CAER)
47 of 101
38393.47
In reply to
38393.44
If you don't want to use SQL, don't use a database that runs on SQL! (
:O
)
From: af (CAER)
20 Apr 2011 13:21
To: steve
48 of 101
38393.48
In reply to
38393.46
Than what? I'm not sure what the corresponding SQL would look like but I'm pretty sure it'd be more complicated than that.
From: Peter (BOUGHTONP)
20 Apr 2011 13:57
To: af (CAER)
49 of 101
38393.49
In reply to
38393.48
quote:
I'm pretty sure it'd be more complicated
I'm not...
sql code:
DELETE
Post
WHERE
Creator
=
findUserByEmail
(
'andy@caerphoto.com'
)
From: af (CAER)
20 Apr 2011 14:17
To: Peter (BOUGHTONP)
50 of 101
38393.50
In reply to
38393.49
Will that also trigger any callbacks set up in the Post model, for example if it's the last Post being deleted, also delete the associated Thread?
And what is this 'findUserByEmail' function?
From: Ken (SHIELDSIT)
20 Apr 2011 14:27
To: Peter (BOUGHTONP)
51 of 101
38393.51
In reply to
38393.49
Pete are you up for a complicated question?
From: Peter (BOUGHTONP)
20 Apr 2011 14:36
To: af (CAER)
52 of 101
38393.52
In reply to
38393.50
Yes, of course, (because that's how my imaginary SQL database has been configured to react).
(It's been possible to do triggers with databases for
years
, long before Rails came along. Probably even before Ruby too.)
It's a function (stored procedure), just like your User.findByEmail one. It's automatically generated by another one of those triggers - every time a table is created or altered - so it's faster than doing dynamic lookups with Method Missing.
From: Peter (BOUGHTONP)
20 Apr 2011 14:39
To: Ken (SHIELDSIT)
53 of 101
38393.53
In reply to
38393.51
If it's a quick complicated one... I'm supposed to be finishing something off at the moment, but keep getting distracted by that dastardly Rails fan.
:@
From: af (CAER)
20 Apr 2011 14:40
To: Peter (BOUGHTONP)
54 of 101
38393.54
In reply to
38393.52
Well now, that's interesting.
I'd best not get too involved in this as I really don't know all that much
:$