Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: table views in related models #424

Open
Oggo87 opened this issue Feb 21, 2019 · 0 comments
Open

Enhancement: table views in related models #424

Oggo87 opened this issue Feb 21, 2019 · 0 comments

Comments

@Oggo87
Copy link

Oggo87 commented Feb 21, 2019

Right now, when relating models, there's no way of using a specific table view for the related model.
It would be a nice feature to be able to do something as the following:

$query = Glazes\Model_Colour::query()
	->related('formulas')
	->use_view('formulas.glaze_formulas_table_view');

Or even to define a default view for the relation:

protected static $_has_many = array(
		'formulas' => array(
			'key_from'       => 'id',
			'model_to'       => 'Glazes\Model_Formula',
			'key_to'         => 'colour_id',
			'view'         => 'glaze_formulas_table_view',
			'cascade_save'   => false,
			'cascade_delete' => false,
			'conditions'	 => array(
					'order_by' => array('date' => 'desc')
			)
	)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant