https://twill.io logo
Join Discord
Powered by
# ❓questions
  • i

    ifox

    09/26/2022, 11:35 PM
    https://twill.io/docs/crud-modules/repositories.html#filtering
  • t

    tfilos

    09/26/2022, 11:40 PM
    Thanks!
  • t

    tfilos

    09/26/2022, 11:58 PM
    @ifox it's supposed to pick up the filter() method if I have one of those traits on my model?
  • t

    tfilos

    09/26/2022, 11:59 PM
    I've tried a few variations on the model without success
  • t

    tfilos

    09/26/2022, 11:59 PM
    Unless these are controller traits
  • i

    ifox

    09/27/2022, 12:01 AM
    do you mean repository?
  • i

    ifox

    09/27/2022, 12:02 AM
    the filter method is to be implemented from the repository class of your module, under App/Repositories
  • t

    tfilos

    09/27/2022, 12:04 AM
    Sorry, that's what I meant the first bit, repository. It doesn't seem to be firing the methof
  • t

    tfilos

    09/27/2022, 12:05 AM
    Actually, it is --- my dd() call fires, but none of the examples do
  • t

    tfilos

    09/27/2022, 12:06 AM
    Aha, the structure is different than the example
  • t

    tfilos

    09/27/2022, 12:10 AM
    Still no luck, but it's something for me to work off of in the morning. Thanks!
  • i

    ifox

    09/27/2022, 12:13 AM
    examples there probably need a review and docs update, let me know what you find
  • t

    tfilos

    09/27/2022, 12:17 AM
    Aha, it's because they're not normal relations, they're in the relations table.
  • t

    tfilos

    09/27/2022, 12:20 AM
    This is all starting to make sense with the computed field
  • i

    ifox

    09/27/2022, 12:46 AM
    oh ok, so you select one artist on albums, or multiple albums in one artist? In any case I would recommend to setup a proper relationship and database structure for such relationship. In the first case, a belongsTo on the album model, with a foreign key artist_id. In the album repository you'd use
    $browsers
    instead of
    $relatedBrowsers
    .
  • d

    dedli

    09/27/2022, 6:50 AM
    Hi, @ifox. Yesterday, I add comment to this topic https://discord.com/channels/811936425858695198/989478663865114664. Could you please give some feedback. Thanks
  • t

    thingasd

    09/27/2022, 7:40 AM
    Hey guys, some questions on the nested module, I pass the parents in formData of the Controller, and I get this. Is there any way to allow searching in the parent page select component and what is the "Go to page" select for?
  • i

    ifox

    09/27/2022, 9:14 AM
    hey @thingasd searching in there, not at the moment, but that could be added. Go to page is meant to be a quick way to move from one sibling child to another, it also has go to previous and go to next links if you provide the data.
  • t

    tfilos

    09/27/2022, 12:38 PM
    You mean like
    protected $browsers = ['artist'];
    in the album repository?
  • i

    ifox

    09/27/2022, 12:38 PM
    yes
  • t

    tfilos

    09/27/2022, 12:38 PM
    I ask because oddly that's what I have
  • i

    ifox

    09/27/2022, 12:39 PM
    oh, so you do have a artist_id column in your albums table then?
  • t

    tfilos

    09/27/2022, 12:39 PM
    Yes
  • t

    tfilos

    09/27/2022, 12:39 PM
    This is why I was confused yesterday, I was unaware it was using the relations table instead of the regular relation
  • i

    ifox

    09/27/2022, 12:41 PM
    I'm not sure I'm following why it'd use the relations table, in what context do you mean? Do you actually see rows in the
    related
    table for the album->artist relationship?
  • t

    tfilos

    09/27/2022, 12:41 PM
    Yes, it looks like all of them are in there
  • t

    tfilos

    09/27/2022, 12:43 PM
    I'm going to try wiping my local DB and running the import again, see if it still goes to the related table
  • i

    ifox

    09/27/2022, 12:46 PM
    are you doing something in
    afterSave
    ?
  • t

    tfilos

    09/27/2022, 12:47 PM
    Nothing like that
  • i

    ifox

    09/27/2022, 12:47 PM
    import? are you programmatically creating the records?
1...407408409...484Latest