scube,

First of all this function getLeftCredits() should not be in CreditsPeer 
class but rather in your  Member.php class (whichever is your class 
holding member information for site)

Once you put the function there you can do:

class Member
{

        public function getLeftCredits()
        {
                $c = new Criteria();
                $c->addAlias('SUM('.CreditsPeer::AMOUNT.')', 'total');
                $c->add(CreditsPeer::USER_ID, $this->getId());
                $c->addGroupByColumn(CreditsPeer::USER_ID);
                $credits = CreditsPeer::doSelectOne($c);
                var_dump($credits);
                return $credits;
        }
}


And this makes sense now : )

Regards,
Kiril

scube wrote:
> Hi folks,
>
> I have an action class where i try to get the amount of left credits.
> so i'll try to make a function for that in the CreditsPeer.php file
> which is generated by propel. I call this function with this: "$this-
>   
>> creditsLeft = CreditsPeer::getLeftCredits();"
>>     
>
> that function looks like this:
> public function getLeftCredits()
>       {
>               $c = new Criteria();
>               $c->addAlias('SUM('.self::AMOUNT.')', 'total');
>               $c->add(self::USER_ID, $this->getUser()->getMemberId());
>               $c->addGroupByColumn(CreditsPeer::USER_ID);
>               $credits = self::doSelectOne($c);
>               var_dump($credits);
>               return $credits;
>       }
>
> And here is my problem, as you see I try to access the sfUser to call
> an own written function from the self written file myUser.class.php in
> the lib folder which looks like this:
> class myUser extends sfBasicSecurityUser
> {
>
>       public function getMemberId()
>       {
>               return 1; # later will be a bit more of code..
>       }
>
> }
>
> now finaly I get these two error:
> - a strict standard (yeah logical, but how can I resolf this?)
> - a symfony error called "Call to undefined method
> sfUser::getMemberId"
>
> what can I do?
>
>
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to