Relation In Between Models

Hello All,

I have a database like this




+------------------+

|     Invoices     |

+------------------+

| id               |

| customer_id (Fk) |

| description      |

+------------------+


+------------------+

|  InvoicesItems   |

+------------------+

| id               |

| invoice_id       |

| item_name        |

| quantity         |

| description      |

+------------------+


+------------------+

|    Customers     |

+------------------+

| id               |

| firstname        |

| lastname         |

| description      |

+------------------+



The relationship in between models are like this:

In Invoices Models the relation is like this




  public function relations()

  {

    return array(

      'invoiceitem' => array(self::HAS_MANY,'InvoiceItems','invoice_id'),

      'customers'   => array(self::BELONGS_TO,'Customers','customer_id'),

    );

  }

 

In InvoicesItems Models the relation is like this




    public function relations()

  {

    return array(

      'invoice' => array(self::BELONGS_TO,'Invoices','invoice_id'),

    );

  }

  

In Customers Model relation is like this




  public function relations()

  {

    return array(

      'invoice' => array(self::HAS_MANY, 'Invoices','customer_id')

    );

  }

  

Can someone tell me that the relationship in between Models are correct or not.Any suggestions and help willbe highly appriciable

Yes they seem correct