I'm trying to move some processing into a behavior.

What I've done so far is, create a file called placehelper.php (in the
model/behaviors dir) like:
class placehelperBehavior extends ModelBehavior
{

        function setup(&$model, $config = array()) {

        }

        function stripText($text)
        {
                print 'text: ' . $text; // gives 'Object of class Place could 
not be
converted to string' error
        }
...


My controller has something like:
$sName = $this->data['Place']['name'];
print '$sName: '. $sName. '<br>';
$this->data['Place']['profile_url'] = $this->Place->stripText($sName);
die();

and the model is like:
class Place extends AppModel {

        var $name = 'Place';
        var $actsAs   = array('placehelper');
...

So right now it seems to get the data, but instead of just passing the
text field, it seems to be passing the whole places object (this is
what it seems if  I do a print_r on what is passed into  the stripText
method.

My question is, How do I pass data from the controller to the Model's
behaviors and then get it back?

Thanks, Zoltan


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to