Skip to content

Model relation option keys autocomplete #346

@dereuromark

Description

@dereuromark

Any idea on how to allow IDE (PHPStorm?) to autocomplete the 2nd arg for options array, the keys?

        $this->hasMany('ADmad/SocialAuth.SocialProfiles', [
            'foreignKey' => 'user_id',
           ...
        ]);

These are the possible keys per type:

/**
 * @var array<string, string>
 */
protected array $optionKeys = [
	'\\' . self::CLASS_TABLE . '::belongsTo' => [
		'className',
		'foreignKey',
		'bindingKey',
		'conditions',
		'joinType',
		'dependent',
		'cascadeCallbacks',
		'propertyName',
		'strategy',
		'finder',
	],
	'\\' . self::CLASS_TABLE . '::hasOne' => [
		'className',
		'foreignKey',
		'bindingKey',
		'conditions',
		'joinType',
		'propertyName',
		'strategy',
		'finder',
	],
	'\\' . self::CLASS_TABLE . '::hasMany' => [
		'className',
		'foreignKey',
		'bindingKey',
		'conditions',
		'sort',
		'dependent',
		'cascadeCallbacks',
		'propertyName',
		'strategy',
		'saveStrategy',
		'finder',
	],
	'\\' . self::CLASS_TABLE . '::belongToMany' => [
		'className',
		'joinTable',
		'foreignKey',
		'bindingKey',
		'targetForeignKey',
		'conditions',
		'sort',
		'dependent',
		'through',
		'cascadeCallbacks',
		'propertyName',
		'strategy',
		'saveStrategy',
		'finder',
	],
];

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions