How to search a single field of 3 tables with JOIN using Respect Relational?

Asked

Viewed 49 times

0

I’m starting to use the framework Respect\Relational and I was just trying to get the names of the chart templates that belong to the id 1 business line, but all the forms I tried always returns all the columns. What would be the right way to do this using the framework Respect\Relational?

This is the image of the necessary bank part:

Tabelas necessárias para a consulta

These were some attempts that also did not work:

$this->mapper->letterTemplatesNames = Filtered::by('name')->letter_templates();

$this->mapper->hiddenLetterTemplatesBusinessLines = 
      Filtered::letter_templates_business_lines();

$response = $this->mapper->letter_templates
      ->letter_templates_business_lines
      ->business_lines[(int) $value]
      ->fetchAll(Sql::orderBy('letter_templates.name')
      ->asc()
      ->limit($limit));

$response = $this->mapper->letter_templates
      ->letter_templates_business_lines(
          array('business_lines_id' => (int) $value))
      ->fetchAll(Sql::orderBy('letter_templates.name')
      ->asc()
      ->limit($limit));

$response = $this->mapper->letterTemplatesNames
      ->letter_templates_business_lines
      ->business_lines[(int) $value]
      ->fetchAll(Sql::orderBy('letter_templates.name')
      ->asc()
      ->limit($limit));

$response = $this->mapper
      ->hiddenLetterTemplatesBusinessLines(
        array('business_lines_id' => (int) $value))
      ->letterTemplatesNames
      ->fetchAll(Sql::orderBy('letter_templates.name')
      ->asc()
      ->limit($limit));
  • Also put the attempts, the codes!

  • 1

    Okay, I forgot. Thank you!

  • it’s best not to work with this Wrapper do not consider a MicroOrm (good this is my opinion), has to improve a lot, mainly in Joins and Select, use a ActiveRecords or Eloquent (is a ORM of Laravel but that works out of also). Just remembering what I tried to do, but at the time of choosing the items of Select I didn’t find how!

  • Got it, I’ll be looking at the items you quoted. Select an option is to use Filtered::by()

  • *Errata: I get it, I’ll be looking at the items you quoted. Select an option is to do through the Filtered::by() which can be used by use Respect\Data\Collections\Filtered;, in the codes posted there is an example of this use.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.