Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
has_access yields an error
  • Hello there!

    I think either I might have configured the Auth package incorrectly, or the Auth package has bugs. Login seems to be ok, but whenever I call has_access, it drops the epic:

    Fuel\Core\Database_Exception [ Error ]:
    SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.id' in 'field list' with query: "SELECT `t0`.`actions` AS `t0_c0`, `t0`.`id` AS `t0_c1`, `t0`.`role_id` AS `t0_c2`, `t0`.`perms_id` AS `t0_c3` FROM `users_role_permissions` AS `t0` WHERE `t0`.`role_id` = '3'"

    error message. Which is funny, because role_permissions is not supposed to have an id field..
    I've checked the package's models and it does require an id field:

    fuel/packages/auth/classes/model/auth/rolepermission.php

    protected static $_properties = array(
    'id',
    'role_id',
    'perms_id',
    'actions'         => array(
    'data_type'  => 'serialize',
    'default'  => array(),
    'null'  => false,
    'form'    => array('type' => false),
    ),
    );


    So is this a bug, or did I do something wrong when I deployed auth?
  • HarroHarro
    Accepted Answer
    You haven't run your Auth migrations, or at least not all of them.

    One of the last migrations introduced the 'id' field as PK. the old design was flawed, as ORM doesn't support PK == FK, even when PK is a compound key.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion