php,mysql,database,phpactiverecord
Your first definition looks wrong I think: $has_many should be an array of arrays, not an array of array of arrays. You have this in your single-has-many example with only students, but in your first example you've added an array. so this works indeed: static $has_many = [ [ 'subjects',...
As far as I know, phpactiverecord does not support composite primary keys, so for some functionality you might want to define a seperate key anyway. Further: the statuscolumn would not be unique in this case? There could be multiple btable_id entries for your atable_id, so there would not be a...
php,activerecord,phpactiverecord
last_query is the raw SQL. PHP ActiveRecord is using PDO's prepared statement so you won't see the actual query. What you should do is using a logger. The values will be shown there (the code). $log = Log::singleton('file', 'my.log'); //using PEAR Log ActiveRecord\Config::instance()->set_logging(true); ActiveRecord\Config::instance()->set_logger($log); Example from: http://www.phpactiverecord.org/boards/4/topics/1119-re-show-last-sql-query...
php,activerecord,orm,phpdoc,phpactiverecord
You can document all your "magic" properties as an @property! Say you have a table "Company" with fields "id, name, location", you would end up with: ** * @property int $id * @property string $name * @property string $location */ class Company extends \ActiveRecord\Model { } You can see in...
Your BIGINT is being cast to an int because of the setting in column.php. While the "real solution" would be to run a 64 bit system, if you cannot, the other thing might be to just stop the cast from happening Look at line 37 in column.php , I suggest...
Well after spending ... all day, I have found a solution. I suppose it might have been common sense but it was not in the documentation so I had to guess. Apparently you can simply say 'is null' in the condition string like regular SQL and it will work... That...
Assumptions: tbl_role has a model named Role tbl_user_role has a model named UserRole tbl_user_role_request has a model named UserRoleRequest Note that this will do 3 seperate queries but I believe this is the closest you can get without creating a total mess. <?php $userId = 35; $roles = UserRole::findAllByCondition(array('userId' =>...