This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Can't hydrate model object.Undefined mthod hydrate()[SOLVED]

Discussion specific to symfony 1.1.x stable

Can't hydrate model object.Undefined mthod hydrate()[SOLVED]

by gentrobot » Mon Jan 17, 2011 1:02 pm

Hi,

I have recently upgraded my project from Symfony 1.0 to 1.1. I have been able to get everything up and running, except for the Propel object. When I try to do query like
Code: Select all
$cr = new Criteria();
$cr->add(TransactionPeer::ID,$this->transactionId);
$transData = TransactionPeer::doSelect($cr);
$this->transactionStatus = $transData->getStatus();

I get an error saying "Undefined method Transaction::hydrate() in BaseTransactionPeer.php".
All the raw queries are working fine.

The error is inside the populateObject function().
It might be some issue with the sfPropelPlugin. When I change all the
Code: Select all
$cls = sfPropel::import($cls);

to
Code: Select all
$cls = Propel::import($cls);


everything starts to work. I am not sure what the problem could be?
gentrobot
Member
 
Posts: 45
Joined: Thu Oct 08, 2009 7:43 am

Re: Can't hydrate model object.Undefined mthod hydrate()[SOL

by gentrobot » Sat Jan 22, 2011 7:56 am

It is not actually solved, I just found a workaround for this. I am using the sfPropel Plugin for Symfony 1.1 to make use of the Propel object. I found that if I change [glow]sfPropel::Import()[/glow] to [glow]Propel::Imoport()[/glow], it started to work.

For this, I have commented the line no 35 in Symfony/lib/plugins/sfPropelPlugin/lib/propel/builder/sfPeerBuilder.php
Code: Select all
        // change Propel::import() calls to sfPropel::import()
-      $peerCode = str_replace('Propel::import(', 'sfPropel::import(', $peerCode);
+     // $peerCode = str_replace('Propel::import(', 'sfPropel::import(', $peerCode);


What exactly is the issue and how to resolve it? Will this workaround cause any problem?
gentrobot
Member
 
Posts: 45
Joined: Thu Oct 08, 2009 7:43 am