PHP Option on two tables

PHP Option on two tables

nessinitsnessinits Posts: 86Questions: 27Answers: 0

Hi,

Is it possible to join two tables in the PHP option class?

 Field::inst( 'users.site' )
        ->options( Options::inst()
            ->table( 'sites' )
            ->value( 'id' )
            ->label( 'name' )
        )

In the example table is "sites", but is it possible to connect it to another table, for example the table domains" and do a where domains.sites_id = sites.id?

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 62,241Questions: 1Answers: 10,210 Site admin
    Answer ✓

    Currently no - sorry. The built in Options class doesn't not have a join option, although I've now added that to the list of features to add.

    At the moment you would need to use a custom function to get the options with a database call.

    Thanks,
    Allan

  • nessinitsnessinits Posts: 86Questions: 27Answers: 0

    Thanks Allan, I'll solve this with a view on those tables until it's supported.

  • allanallan Posts: 62,241Questions: 1Answers: 10,210 Site admin
    Answer ✓

    Good idea - I should have thought of that as well. Thanks for noting that.

    Allan

This discussion has been closed.