Jump to content

prestashop Undefined property: Doctors::$associations


Recommended Posts

I'm trying to make admin controller for table that will have many to many relationship the solution i found was using assosiation on my object model but i got error Notice: Undefined property: Doctors::$associations the model is

require_once _PS_ROOT_DIR_.'/modules/tender/override/Hospitals.php';
class Doctors extends ObjectModel{
    //put your code here
    public $id;
    public $name;
    public $odoo_id;
    public $create_time;
    public $update_time;
    public $create_user_id;
    public $update_user_id;

    public static $definition=[
      'table'=>'tender_doctor',
        'primary'=>'id',
        'fields'=>[
            'name'=>['type'=>self::TYPE_STRING,'validation'=>'isAnything','required'=>true],
            'odoo_id'=>['type'=>self::TYPE_STRING,'validation'=>'isAnything','required'=>true],
            'create_user_id'=>['type'=>self::TYPE_INT,'validation'=>'isAnything','required'=>false],
            'update_user_id'=>['type'=>self::TYPE_INT,'validation'=>'isAnything','required'=>false],
            'create_time'=>['type'=>self::TYPE_DATE,'validation'=>'isAnything','required'=>false],
            'update_time'=>['type'=>self::TYPE_DATE,'validation'=>'isAnything','required'=>false],
             'associations'=>array(
            'doctor_hos' =>array('type' => self::HAS_MANY, 'field' => 'id', 'object' => 'Hospitals', 'association' => 'tender_doctor_hospital'),


          ),

        ],
    ];
    }

 

Link to comment
Share on other sites

3 hours ago, Solver said:

Hello, 


Does associations exist in database table?

Why you made it in fields?

yes associations exist

and i try to show multi choice or multi selctbox for 2 tables hospital have many doctors and doctors work in many hospitals (many to many) relation

Edited by Abo Anas (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...