Hello

i'm having some troubles with an HABTM relationship.

the following code isn't my real app, just a simplified version.

my app has 3 models
- Customer
- Phone_Number
- Customer_PhoneNumber

in "Customer" model i defined the HABTM relationship:

class Customer extends AppModel {

        var $hasAndBelongsToMany = array(
                "PhoneNumbers" => array(
                        "className" => "PhoneNumber",
                        "with" => "Customer_PhoneNumber",
                        "foreignKey" => "customer_id",
                        "associationForeignKey" => "phonenumber_id"
                )
        );

}

and in "Customer_Order" model i'm using the afterFind method:

class PhoneNumber extends AppModel {

        //uncomment the following string to generate an error, demonstrating
that the model is called
        //var $useTable = "sometable";

        function afterFind($results, $primary = false) {
                echo "Hello!! i'm the afterFind method";
                print_r($results);
                return $results;
        }

}

Relationship is working correctly (data is loaded, and no errors are
returned) but...

the afterFind() function in Customer_PhoneNumber seems to be ignored.




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