Skip to content

Instantly share code, notes, and snippets.

@leocavalcante
Last active December 24, 2015 01:10
Show Gist options
  • Select an option

  • Save leocavalcante/6722197 to your computer and use it in GitHub Desktop.

Select an option

Save leocavalcante/6722197 to your computer and use it in GitHub Desktop.
<?php
class Html {
public function renderSelect($name, $options) {
//
}
public function renderCampaignsSelect() {
return $this->renderSelect('campaign_id', $repository->listsCampaigns());
}
public function renderAccountsSelect() {
return $this->renderSelect('account_id', $repository->listsAccounts());
}
}
class Repository {
public function lists($repositoryName, $keyColumn, $valueColumn) {
//
}
public function listsCampaigns() {
return $this->lists('campaigns', 'id', 'name');
}
public function listsAccounts() {
return $this->lists('accounts', 'id', 'company');
}
}
#
$html->renderCampaignsSelect();
$html->renderAccountsSelect();
<?php
class Html {
public function renderSelect($name, $options) {
//
}
}
class Repository {
public function lists($repositoryName, $keyColumn, $valueColumn) {
//
}
}
#
$html->renderSelect('campaign_id', $repository->lists('campaigns', 'id', 'name'));
$html->renderSelect('account_id', $repository->lists('accounts', 'id', 'company'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment