Pluf Framework

Sign in or create your account | Project List | Help

Issue 184: Proposal: get method

Reported by Bruno, Apr 8, 2009

We've spoken about the getOne() method on the mailing list. What 
about this ? Just check if the parameter given to get() method is an 
array, if so call getList and throw an error if the result is too 
long.

I tested it on my box and it works fine... What do you think about 
it ?

Comment 1 by Bruno, Apr 8, 2009

I forgot the patch...

Comment 2 by Loïc d'Anterroches, Apr 8, 2009

The only problem I see at the moment is that I wanted to be able to 
use the get method with multi-field based primary keys. This will 
conflict. 

I think a simple getOne() method would be better. I am still ensure 
with the null or Exception in case of error.
Labels: Type:Enhancement, -Type:Defect
Summary: Proposal: get method

Comment 3 by Bruno, Apr 8, 2009

I see. There is also the possibility to check if the parameter is a 
$key=>$value array or a simple list, but I admit it is a bit 
tricky.

get() returns false if the result length is 0... Wouldn't getOne()'s 
behaviour be the same ?

Comment 4 by Loïc d'Anterroches, May 15, 2009

Bruno, what about making the method a static method?

This make more sens as we do not need to create first a model on the 
stack to then get the model we want.

I will implement in a static way and you will tell me what you think 
about it.

Comment 5 by Loïc d'Anterroches, May 15, 2009

Added in commit 7aa17fc. 

Pas en statique car __CLASS__ dans un appel statique à une méthode 
va être dans ce cas Pluf_Model car la méthode est définie dans cette 
class.
Status: Fixed

Created: 1 year 5 months ago by Bruno

Updated: 1 year 3 months ago

Status: Fixed

Followed by: 1 person

Labels:
Type:Enhancement
Priority:Medium