Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorGKSR
     
    I have two models: property and property_distance, which are habtm related. Now i have a table properties_property_distances.
    The following are the field names: id, property_id, property_distance_id, location_name, location_distance, distance_unit.

    Now when i use this query,
    $this->property_distances_arrays = $this->Property->property_distance->load();

    I am only getting the property_distance_id values i.e. {property_distances_array.id}. I am unable to get the other fields values.
    for ex: {property_distances_array.location_name}
    its showing an error:
    Notice: Undefined property: PropertyDistance::$location_name in C:\xampp\htdocs\vra\tmp\views\app\views\property\compiled\_form.tpl.php on line 182

    How can i fetch the other fields values(location_name, location_distance, distance_unit)...
    • CommentAuthorKaste
     

    So-called 'rich' join models you have to define explicitly.

    Say you have the more usual posts :habtm tags. The join table hereby is somehow hidden. Rewrite it like: posts :has_many taggings and a tagging :belongs_to a tag. Now you gained control over the taggings.

    As long as you can find a nice name for your properties_property_distances this feels natural.