1 to 6 of 6
Why does this code:
<?php echo $form_options_helper->select('parts_vendors', 'vendor_id', $Vendor->collect($Vendor->find(), 'Name', 'id')); ?>
Suddenly start producing this error:
Fatal error: You are calling recursivelly AkActiveRecord::getAttribute by placing parent::getAttribute()
or parent::get() on your model "getId" method. In order to avoid this, set the 2nd paramenter of
parent::getAttribute to FALSE. If this was the behaviour you expected, please define the constant
AK_ACTIVE_RECORD_PROTECT_GET_RECURSION and set it to false in
/home/sambaserve/web/akelos/lib/AkActiveRecord.php on line 1780
It worked before, but now it throws this error. How odd! I did change a table fieldname from "name" to "Name", and I've been going around and updating everything I can find that references it. Does anyone recognize this error?
There is a frustrating recursion bug that happens when you declare a method like getName() and then use get('name') in its declaration, as get('name') looks first for a getName() method.
In order to prevent this, Akelos has a watchdog that prevents calling more than 66 times get('attribute') for a given attribute. To deactivate the watchdog you just need to declare in your config.php
define('AK_ACTIVE_RECORD_PROTECT_GET_RECURSION', false);
The same goes for setters.
AH, ok. I wasn't sure where that was coming from. After your suggestion it works great. It only happened after my Vendor table expanded to 200 entries. (mass insert, so it was most likely right at 66 that it started occurring.) Thanks!
Bermi, is this patch correct ?
Index: AkActiveRecord.php
===================================================================
--- AkActiveRecord.php (revision 503)
+++ AkActiveRecord.php (working copy)
@@ -4721,7 +4721,7 @@
$resulting_array = array();
if(!empty($source_array) && is_array($source_array)) {
foreach ($source_array as $source_item){
- $resulting_array[$source_item->get($key_index)] = $source_item->get($value_index);
+ $resulting_array[$source_item->get($key_index, false)] = $source_item->get($value_index, false);
}
}
return $resulting_array;
wbr, Aleksandr Guidrevitch
When you set the second argument to false the getter wont look for explicit get-methods. bah, I mean get('name') will look for a method named getName().
1 to 6 of 6