1 to 4 of 4
For the purposes of this problem, I have two tables:
Inside the model directory, I have the relationships clearly stated both in parts_vendors.php and unit.php. I can add and modify to my hearts content without generating errors.
However, when I go to delete a 'unit', this error appears after pressing the 'Delete' button: Fatal error: Class 'PartsVendor' not found in /home/sambaserve/web/akelos/lib/AkActiveRecord/AkHasMany.php on line 613
And that's because the Class name is actually 'PartsVendors', notice the "s" on the end.
AkHasMany.php line 613 $ModelInstance =& new $class_name();
inside thisfunction &getAssociatedModelInstance()
{
static $ModelInstance;
if(empty($ModelInstance)){
$class_name = $this->getOption($this->association_id, 'class_name');
Ak::import($class_name);
$ModelInstance =& new $class_name();
}
return $ModelInstance;
}
Obviously the error stems from the fact that I used a plural form when creating my "parts_vendors" model/controller. However, that is what the convention said I should do. PartsVendors is the middle table between "Part" and "Vendor". Thus the plural form of part and vendor.
Perhaps Akelos should check for the plural version as well as a singular version of a Class if it has a "_" in it's name. Like I said, I can add and modify all I want to all related tables, but not delete from any model/controller which has "$has_many = "parts_vendors"" in it's model definition.
Other than renaming three of my tables (other middle tables) and redoing a bunch of coding (making all PartsVendors singular), what options do I have? ;-()
declare options, man.
class unit...
has_many = array('parts_vendors' => array('class_name' => 'PartsVendors');
see doc at the beginning of AkHasMany. line58 ... or so
hands another free beer to Kaste Ah, yup, I see the options now. This kind of stuff should be documented somewhere. Thanks again Kaste.
so it should be more clearly documented that we have documents .. ation .. ally
1 to 4 of 4