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

  • Home
  • SEARCH
  • 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 6076019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:33:36+00:00 2026-05-23T10:33:36+00:00

I have a problem with relationships in the Doctrine. Works on Mysql database. The

  • 0

I have a problem with relationships in the Doctrine. Works on Mysql database. The problem occurs when downloading data using the relationship throws me this error: Doctrine_Table_Exception: Unknown relation alias Model_Training

Please help me get tired of it some days I sit on it and nothing came up, and google also did not find anything.

Here is the code that retrieves data:

$dataRows = Doctrine_Query::create()
                    ->from('Model_Training a')->where('a.idTrainings = ?', $this->_getParam('id'))
                    ->leftJoin('a.Model_TrainingBonuse ac')
                    ->leftJoin('a.Model_Bonuse ad')
                    ->fetchArray();

Schema.yml file with the formation of models for the Doctrine:

TrainingBonuse:
  tableName: Trainings_has_Bonuses
  columns:
    Trainings_idTrainings:
      type: integer(4)
      notnull: true
      autoincrement: true
    Bonuses_idBonuses:
      type: integer(4)
      notnull: true
  relations:
    TrainingsIdTraining:
      class: Training
      local: Trainings_idTrainings
      foreign: idTrainings
      foreignAlias: Trainings_has_Bonuses
    BonusesIdBonuse:
      class: Bonuse
      local: Bonuses_idBonuses
      foreign: idBonuses
      foreignAlias: Trainings_has_Bonuses
  indexes:
    fk_Trainings_has_Bonuses_Bonuses1:
      fields: [Bonuses_idBonuses]
    fk_Trainings_has_Bonuses_Trainings1:
      fields: [Trainings_idTrainings]
  options:
    charset: utf8
    collate: utf8_polish_ci

Bonuse:
  tableName: Bonuses
  columns:
    idBonuses:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    name:
      type: string(45)
    title:
      type: string(255)
    description:
      type: clob(65535)
    file_url_full:
      type: string(255)
    file_type:
      type: integer(1)
    width_full:
      type: integer(4)
    height_full:
      type: integer(4)
    active:
      type: integer(1)
      default: 1
  options:
    charset: utf8
    collate: utf8_polish_ci

Training:
  tableName: Trainings
  columns:
    idTrainings:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    title:
      type: string(255)
    sub_title:
      type: string(255)
    up_body:
      type: clob(65535)
    training_body:
      type: clob(65535)
    question:
      type: clob(65535)
    opinion:
      type: clob(65535)
    bonuses:
      type: integer(1)
      notnull: true
      default: 0
    down_body:
      type: clob(65535)
    modyfication:
      type: integer(1)
      notnull: true
      default: 0
    active:
      type: integer(1)
      notnull: true
      default: 1
  options:
    charset: utf8
    collate: utf8_polish_ci

Models:
TRAINING

abstract class Model_Base_Training extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->setTableName('Trainings');
        $this->hasColumn('idTrainings', 'integer', 4, array(
             'type' => 'integer',
             'primary' => true,
             'autoincrement' => true,
             'length' => '4',
             ));
        $this->hasColumn('title', 'string', 255, array(
             'type' => 'string',
             'length' => '255',
             ));
        $this->hasColumn('sub_title', 'string', 255, array(
             'type' => 'string',
             'length' => '255',
             ));
        $this->hasColumn('up_body', 'clob', 65535, array(
             'type' => 'clob',
             'length' => '65535',
             ));
        $this->hasColumn('training_body', 'clob', 65535, array(
             'type' => 'clob',
             'length' => '65535',
             ));
        $this->hasColumn('question', 'clob', 65535, array(
             'type' => 'clob',
             'length' => '65535',
             ));
        $this->hasColumn('opinion', 'clob', 65535, array(
             'type' => 'clob',
             'length' => '65535',
             ));
        $this->hasColumn('bonuses', 'integer', 1, array(
             'type' => 'integer',
             'notnull' => true,
             'default' => 0,
             'length' => '1',
             ));
        $this->hasColumn('down_body', 'clob', 65535, array(
             'type' => 'clob',
             'length' => '65535',
             ));
        $this->hasColumn('modyfication', 'integer', 1, array(
             'type' => 'integer',
             'notnull' => true,
             'default' => 0,
             'length' => '1',
             ));
        $this->hasColumn('active', 'integer', 1, array(
             'type' => 'integer',
             'notnull' => true,
             'default' => 1,
             'length' => '1',
             ));

        $this->option('collate', 'utf8_polish_ci');
        $this->option('charset', 'utf8');
        $this->option('type', 'InnoDB');
    }

    public function setUp()
    {
        parent::setUp();
        $this->hasMany('Model_UserTraining as Users_has_Trainings', array(
             'local' => 'idTrainings',
             'foreign' => 'Trainings_idTrainings'));

        $this->hasMany('Model_TrainingBonuse as Trainings_has_Bonuses', array(
             'local' => 'idTrainings',
             'foreign' => 'Trainings_idTrainings'));
    }
}

TRAINING_BONUSES

abstract class Model_Base_TrainingBonuse extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->setTableName('Trainings_has_Bonuses');
        $this->hasColumn('Trainings_idTrainings', 'integer', 4, array(
             'type' => 'integer',
             'notnull' => true,
             'autoincrement' => true,
             'length' => '4',
             ));
        $this->hasColumn('Bonuses_idBonuses', 'integer', 4, array(
             'type' => 'integer',
             'notnull' => true,
             'length' => '4',
             ));


        $this->index('fk_Trainings_has_Bonuses_Bonuses1', array(
             'fields' => 
             array(
              0 => 'Bonuses_idBonuses',
             ),
             ));
        $this->index('fk_Trainings_has_Bonuses_Trainings1', array(
             'fields' => 
             array(
              0 => 'Trainings_idTrainings',
             ),
             ));
        $this->option('collate', 'utf8_polish_ci');
        $this->option('charset', 'utf8');
        $this->option('type', 'InnoDB');
    }

    public function setUp()
    {
        parent::setUp();
        $this->hasOne('Model_Training as TrainingsIdTraining', array(
             'local' => 'Trainings_idTrainings',
             'foreign' => 'idTrainings'));

        $this->hasOne('Model_Bonuse as BonusesIdBonuse', array(
             'local' => 'Bonuses_idBonuses',
             'foreign' => 'idBonuses'));
    }
}

BONUSES

abstract class Model_Base_Bonuse extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->setTableName('Bonuses');
        $this->hasColumn('idBonuses', 'integer', 4, array(
             'type' => 'integer',
             'primary' => true,
             'autoincrement' => true,
             'length' => '4',
             ));
        $this->hasColumn('name', 'string', 45, array(
             'type' => 'string',
             'length' => '45',
             ));
        $this->hasColumn('title', 'string', 255, array(
             'type' => 'string',
             'length' => '255',
             ));
        $this->hasColumn('description', 'clob', 65535, array(
             'type' => 'clob',
             'length' => '65535',
             ));
        $this->hasColumn('file_url_full', 'string', 255, array(
             'type' => 'string',
             'length' => '255',
             ));
        $this->hasColumn('file_type', 'integer', 1, array(
             'type' => 'integer',
             'length' => '1',
             ));
        $this->hasColumn('width_full', 'integer', 4, array(
             'type' => 'integer',
             'length' => '4',
             ));
        $this->hasColumn('height_full', 'integer', 4, array(
             'type' => 'integer',
             'length' => '4',
             ));
        $this->hasColumn('active', 'integer', 1, array(
             'type' => 'integer',
             'default' => 1,
             'length' => '1',
             ));

        $this->option('collate', 'utf8_polish_ci');
        $this->option('charset', 'utf8');
        $this->option('type', 'InnoDB');
    }

    public function setUp()
    {
        parent::setUp();
        $this->hasMany('Model_TrainingBonuse as Trainings_has_Bonuses', array(
             'local' => 'idBonuses',
             'foreign' => 'Bonuses_idBonuses'));
    }
}
  • 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-23T10:33:37+00:00Added an answer on May 23, 2026 at 10:33 am

    There’s no “Model_Training” table definition in your schema.yml file…theres “Training” though… If there’s no “alias class” or “foreign alias” element specified in your schema.yml, table definition’s name is used. So instead of “Model_Training” use “Training” (this applies to “Model_Bonuses” and others too).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a problem with inserting a new row in database using Doctrine
I have a problem with Core Data. The problem happens with this scenario :
I have a problem with core data when setting relationships: The code below crashes
I have recently stumbled upon a problem with selecting relationship details from a 1
I have a very big problem. I am making a CRM (Costumer Relationship Management)
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
i have problem to correctly bind data to WPF Chart. When i'm setting ItemsSource
I'm having a problem with relationships between to entities in Core Data. I'm parsing
I am new to ADO.net and have this problem: Let's assume I have these
I have what I assume is a configuration problem with my Doctrine schema.yml, but

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.