Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6826819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:11:35+00:00 2026-05-26T22:11:35+00:00

My join looks like this in sql: SELECT m.* FROM settings AS s LEFT

  • 0

My join looks like this in sql:

   SELECT m.* 
     FROM settings AS s 
LEFT JOIN modules AS m on s.name = m.module 
    WHERE s.value = 1 
      AND s.category = 'module_status'

I cannot figure out how to reproduce this in Doctrine 2. Any help is greatly appreciated!

Here are my entities:

namespace Entities;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * Modules
 *
 * @Table(name="modules")
 * @Entity(repositoryClass="Repositories\Modules")
 */
class Modules
{
    /**
     * @var integer $id
     *
     * @Column(name="id", type="integer", nullable=false)
     * @Id
     * @GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string $module
     * @Column(name="module", type="string", length=255, nullable=false)
     */
    private $module;

    /**
     * @var string $label
     * @Column(name="label", type="string", length=255, nullable=false)
     */
    private $label;

    /**
     * @var string $package
     *
     * @Column(name="package", type="string", length=255, nullable=true)
     */
    private $package;

    /**
     * @var string $path
     *
     * @Column(name="path", type="string", length=255, nullable=true)
     */
    private $path;

    /**
     * @var float $version
     *
     * @Column(name="version", type="float", nullable=false)
     */
    private $version;

    public function getId() {
        return $this->id;
    }

    public function getModule() {
        return $this->module;
    }

    public function getLabel() {
        return $this->label;
    }

    public function getPackage() {
        return $this->package;
    }

    public function getPath() {
        return $this->path;
    }

    public function getVersion() {
        return $this->version;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function setModule($module) {
        $this->module = $module;
    }

    public function setLabel($label) {
        $this->label = $label;
    }

    public function setPackage($package) {
        $this->package = $package;
    }

    public function setPath($path) {
        $this->path = $path;
    }

    public function setVersion($version) {
        $this->version = $version;
    }


}



namespace Entities;


use Doctrine\ORM\Mapping as ORM;

/**
 * Settings
 *
 * @Table(name="settings")
 * @Entity(repositoryClass="Repositories\Settings")
 */
class Settings
{
    /**
     * @var integer $id
     *
     * @Column(name="id", type="integer", nullable=false)
     * @Id
     * @GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string $name
     *
     * @Column(name="name", type="string", length=255, nullable=true)
     */
    private $name;

    /**
     * @var string $category
     *
     * @Column(name="category", type="string", length=255, nullable=true)
     */
    private $category;

    /**
     * @var text $value
     *
     * @Column(name="value", type="text", nullable=true)
     */
    private $value;

    public function getId() {
        return $this->id;
    }

    public function getName() {
        return $this->name;
    }

    public function setName($name) {
        $this->name = $name;
    }

    public function getCategory() {
        return $this->category;
    }

    public function setCategory($category) {
        $this->category = $category;
    }

    public function getValue() {
        return $this->value;
    }

    public function setValue($value) {
        $this->value = $value;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:11:35+00:00Added an answer on May 26, 2026 at 10:11 pm

    First, you need an association configured between the Settings and Modules entities. I’m assuming the relationship between the two is many-to-many:

    Class Modules
    {
        /**
         * @ManyToMany(targetEntity="Settings", inversedBy="modules")
         * @JoinTable(name="modules_settings")
         */
        private $settings;
    }
    
    Class Settings
    {
        /**
         * @ManyToMany(targetEntity="Modules", mappedBy="settings")
         */
        private $modules;
    }
    

    Then your query syntax would look like this:

    $qb->select('s', 'm')
       ->from('Entities\Settings', 's')
       ->leftJoin('s.modules')
       ->where('s.value = 1');
    

    I can’t tell what’s going on in your AND clause, but if what you have is correct, then you simply add this line to the end of your query:

    ->andWhere('s.category = m.status');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have an SQL statement looks like this SELECT T1.NAME, COUNT(T2.VALUE) AS numInstances
my table looks like this: +--------------------------+ | key | value-name | value | +-----+------------+-------+
So I've got a SQL statement that pared down looks something like this: SELECT
I have a join in a oracle query which looks like: FROM eiv.table1 eiv.table2
I am using Access and have this SQL SELECT land.id, land.official_name, vaksiner.vaksiner FROM land
I execute SQL scripts to change the database schema. It looks something like this:
I have data that looks like this: entities id name 1 Apple 2 Orange
I have a query that looks like this: SELECT SUM(`georder`) AS `order`, SUM(quantity) AS
What does STRAIGHT_JOIN do in this code ? SELECT STRAIGHT_JOIN ClosingBalance FROM Accounts WHERE
I have a stored proc in SQL Server 2005, which looks like the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.