ModelCriteria should have an exist method. #427

Closed
Meijuh opened this Issue Jul 24, 2012 · 13 comments

3 participants

@Meijuh

I think a good feature in the ModelCriteria class is a public function exist($con = null) which returns a boolean.
Underwater it should do an EXIST SELECT .... which also returns true or false. Then, someone does not have to check if find() returns an empty collection or count() returns zero.

Maybe this is also good for performance?

@fzaninotto
Propel member

Great idea!

@willdurand
Propel member

@Meijuh wanna ship it?

@Meijuh

@willdurand I am quite new to git. Do you mean I implement this in ModelCriteria, write tests and then do a pull request?

@willdurand
Propel member

Yes! It would be wonderful

@Meijuh

Okey, I think I have some time this week to implement this. I think you have to assign me to this issue?

@willdurand
Propel member
@Meijuh

I haven't implemented this yet, but I would not mind implementing it this week. Is it okey if I do a pull request before end of the week?

@willdurand
Propel member
@fzaninotto
Propel member

By the way I think the method should be named isEmpty(), exists(), or hasResults(), to match the naming scheme used for other ModelCriteria methods.

@willdurand
Propel member

Is EXIST available on all database vendors?

@Meijuh

I think this will cost me too much time to implement as I have to dig deep into Propel. Can anyone else implement this?

@willdurand
Propel member

Can you tell me if EXIST is cross vendors?

@willdurand
Propel member

@Meijuh See: #438, please try.

@willdurand willdurand added a commit that closed this issue Aug 7, 2012
@willdurand willdurand Add new termination method: exists()
Closes #427.
Issue URL: #427.
754adbf
@willdurand willdurand closed this in 754adbf Aug 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment