I'm trying to set up a simple test example of behaviors.  I actually
have a working version of the behavior on another app.  But my model
seems to ignore the actAs parameter on my test version.

Here's the model:
<?php

class TestTable extends AppModel
{
    var $name = 'TestTable';
    var $useTable = 'test_tables';
    var $actsAs = array('Normalizer');
}

?>


Here's the behavior:
<?php

class NormalizerBehavior extends ModelBehavior {

    public $name = 'Normalizer';

    /*
        Initiate behaviour for the model using specified settings.
     */
    function setup(&$Model, $settings = array())
    {
    }

    /*
        Run before a model is saved.
     */
    function beforeSave(&$Model)
    {
    }

    function ymd_date(&$Model, $date_str)
    {
        return date('Y-m-d', strtotime(trim($date_str)));
    }

    function test_normalizer(&$Model)
    {
        return sprintf('testing behavior %s for model %s', __CLASS__,
$Model->name);
    }
}

?>


Here's the controller method:
function test_behavior()
    {
        $btest = $this->TestTable->test_normalizer();
        $this->set('header', 'Report View');
        $this->set('data', $btest);
        $this->set('menu', $this->_get_methods());
        $this->render('report');
    }


Here's the error:
Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near 'test_normalizer' at line 1

When I dump the model object, the actsAs parameter is empty.  What am
I missing here?

Using CakePHP version 1.2.0.6311 beta

Thanks,
Tom
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to