Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorbloogrox
    i have model User, User $has_one Wallet
    $Wallet = $_User->wallet->find(); // i want to retrieve wallet object associated to user
    Notice: Tried 'SELECT wallets.* FROM wallets LEFT OUTER JOIN users ON users.id = wallets.user_id WHERE wallets.user_id = '12' AND ( __owner.type = 'User' ) '. Got: [1054] Unknown column '__owner.type' in 'where clause' in C:\xampp\htdocs\showbirja\lib\AkActiveRecord\AkDbAdapter.php on line 226

    i copy paste this sql to sqlmanager and execute,
    without "AND ( __owner.type = 'User' )" it works fine

    is it bug?
    how could i get over it ?

    • CommentAuthorsuthern

    If each user has only one wallet, (Table user has 'wallet_id'), what about using $Wallet = $_User->wallet->load();

    • CommentAuthorbloogrox
    and what if
    Table wallet has 'user_id', but
    table user doesn't have 'wallet_id'.
    • CommentAuthorsuthern

    BlooGrox, this thread is a couple of years old. Are you still around? Sorry I never saw your response.

    Putting the user_id inside the schema wallet is interesting. As long as you have defined your models correctly (Has_one and belongs_to), then


    should work just fine.