I have this model at app/models/product.php:
class Product extends AppModel
{
var $hasAndBelongsToMany = 'WishList';
var $actAs = array('Domainable');
function beforeFind($query)
{
echo "A";
}
}
Which uses this Behavior at app/models/behaviors/Domainable.php:
class DomainableBehavior extends ModelBehavior
{
function beforeFind(&$model, $query)
{
echo "B";
}
}
When I view a Product page the A is echoed but the B is not. I get no error.
I don’t even think the Behavior is loading at all.
I set the file permissions on Domainable.php to 0777 – still not working so not a permissions problem.
I changed the line:
var $actAs = array('Domainable');
to:
var $actAs = array('does-not-exist');
I get no difference. No error.
First of all, I do not understand why: if the Behavior is not loaded it would not give me some sort of error message with a reason like: “not found” or “access denied.” Is this supposed to generate an error?
It needs to be
$actsAswith the s instead.And yes when you use the right variable name it does give an error when it can’t find the behavior.