Glenn Eggleton Tue May 03 06:06:10 -0400 2011

Subject: ignore xD

[code]
$a = array('conditions' => $attr[$key]['source_condition']);
$its = call_user_func(array("app\\models\\".$attr[$key]['source'], 'find'), 'all', $a);
[/code]

$attr[$key]['soruce_condition'] = 'disabled=0';
$attr[$key]['soruce'] = Source;

Code correctly calls the find method, however does not pass the arguments.
All records are returned instead of the ones with disabled=0.

I have tried call_user_func_array() same problem.

Turns out that somewhere in my code the array was being over-wrote and source condition was being set to null.
The stack trace comes from a different object not having the disabled column.
Everything works as intended :D


Glenn Eggleton Tue May 03 06:10:48 -0400 2011

just tried, forward_static_call() same problem

Glenn Eggleton Tue May 03 06:13:45 -0400 2011

also,

statically putting in 'disabled=0' in place of the $attr[$key]['source_condition'] produces a column not found error...

Glenn Eggleton Tue May 03 06:17:55 -0400 2011

<b>Fatal error</b>: Uncaught exception 'ActiveRecord\DatabaseException' with message '42S22, 1054, Unknown column 'disabled' in 'where clause'' in libraries/activerecord/lib/Connection.php:312
Stack trace:
#0 libraries/activerecord/lib/Table.php(218): ActiveRecord\Connection->query('SELECT * FROM `...', Array)
#1 libraries/activerecord/lib/Table.php(209): ActiveRecord\Table->find_by_sql('SELECT * FROM `...', Array, false, NULL)
#2 libraries/activerecord/lib/Model.php(1560): ActiveRecord\Table->find(Array)
#3 [internal function]: ActiveRecord\Model::find('all', Array)
#4 libraries/activerecord/lib/Model.php(1388): call_user_func_array('static::find', Array)
#5 [internal function]: ActiveRecord\Model::all(Array)
#6 app/models/Test.php(79): forward_static in <b>libraries/activerecord/lib/Connection.php</b> on line <b>312</b><br />

Yoan B Wed May 04 15:54:07 -0400 2011

Hey LuckyBugger┬╣!

I just wanted to show you how to make your life easier:

1 $attrkey = $attr[$key];
2 
3 $class = 'app\\models\\'.$attrkey['source'];
4 $its = $class::all(array('conditions' => $attrkey['source_condition']));

┬╣ http://lithify.me/en/bot/logs/li3/2011-05-03#32

Yoan B Wed May 04 16:05:36 -0400 2011
Glenn Eggleton Wed May 04 16:33:20 -0400 2011

Hey Yoan,

I do remember trying the method you posted above, however i was getting a php error about escaped strings...

(1-6/6)