本文整理汇总了PHP中Companies::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Companies::find方法的具体用法?PHP Companies::find怎么用?PHP Companies::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Companies
的用法示例。
在下文中一共展示了Companies::find方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchAction
public function searchAction()
{
$numberPage = 1;
if ($this->request->isPost()) {
$query = Phalcon_Model_Query::fromInput("Companies", $_POST);
$this->session->conditions = $query->getConditions();
} else {
$numberPage = $this->request->getQuery("page", "int");
if ($numberPage <= 0) {
$numberPage = 1;
}
}
$parameters = array();
if ($this->session->conditions) {
$parameters["conditions"] = $this->session->conditions;
}
$parameters["order"] = "id";
$companies = Companies::find($parameters);
if (count($companies) == 0) {
Flash::notice("The search did not find any companies", "alert alert-info");
return $this->_forward("companies/index");
}
$paginator = Phalcon_Paginator::factory("Model", array("data" => $companies, "limit" => 10, "page" => $numberPage));
$page = $paginator->getPaginate();
$this->view->setVar("page", $page);
$this->view->setVar("companies", $companies);
}
示例2: searchAction
public function searchAction()
{
$numberPage = 1;
if ($this->request->isPost()) {
$query = Criteria::fromInput($this->di, "Companies", $_POST);
$this->persistent->searchParams = $query->getParams();
} else {
$numberPage = $this->request->getQuery("page", "int");
if ($numberPage <= 0) {
$numberPage = 1;
}
}
$parameters = array();
if ($this->persistent->searchParams) {
$parameters = $this->persistent->searchParams;
}
$companies = Companies::find($parameters);
if (count($companies) == 0) {
$this->flash->notice("The search did not find any companies");
return $this->forward("companies/index");
}
$paginator = new Phalcon\Paginator\Adapter\Model(array("data" => $companies, "limit" => 10, "page" => $numberPage));
$page = $paginator->getPaginate();
$this->view->setVar("page", $page);
$this->view->setVar("companies", $companies);
}
示例3: searchAction
/**
* Searches for companies
*/
public function searchAction()
{
$numberPage = 1;
if ($this->request->isPost()) {
$query = Criteria::fromInput($this->di, "Companies", $_POST);
$this->persistent->parameters = $query->getParams();
} else {
$numberPage = $this->request->getQuery("page", "int");
}
$parameters = $this->persistent->parameters;
if (!is_array($parameters)) {
$parameters = array();
}
$parameters["order"] = "id";
$companies = Companies::find($parameters);
if (count($companies) == 0) {
$this->flash->notice("The search did not find any companies");
return $this->dispatcher->forward(array("controller" => "companies", "action" => "index"));
}
$paginator = new Paginator(array("data" => $companies, "limit" => 10, "page" => $numberPage));
$this->view->page = $paginator->getPaginate();
}
示例4: findOwnerCompany
/**
* Return owner company from database
*
* @param void
* @return Company
*/
function findOwnerCompany()
{
return Companies::find(array('conditions' => array('is_owner = ?', true), 'one' => true));
}
示例5: getDelete
public function getDelete($id = '')
{
if ($id == '') {
return Redirect::to($this->route)->with('msg_error', Lang::get('messages.companies_display_err'));
} else {
$company = Companies::find($id);
$delete = Companies::destroy($id);
if (!$delete) {
return Redirect::to($this->route . '/trash')->with('msg_error', Lang::get('messages.companies_delete_err', array('title' => $company->title)));
} else {
return Redirect::to($this->route . '/trash')->with('msg_success', Lang::get('messages.companies_delete', array('title' => $company->title)));
}
}
}
示例6: doDelete
/**
* Form for POST doDelete the specified resource.
*
* @return Response
*/
public function doDelete()
{
$aData = Input::all();
if (isset($aData['id'])) {
$company = Companies::find($aData['id']);
$company->delete();
return Redirect::route('company-list')->with('message', 'Компания успешно удален');
}
return Redirect::route('company-list')->with('message', 'Произошла ошибка удаления');
}
示例7:
use backend\models\companies;
/* @var $this yii\web\View */
/* @var $model backend\models\Branches */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="branches-form">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'companies_company_id')->dropDownList(ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'), ['promp' => 'Select Company']);
?>
<?php
echo $form->field($model, 'branch_name')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'branch_address')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'branch_status')->dropDownList(['active' => 'Active', 'inactive' => 'Inactive'], ['prompt' => 'Status']);
?>
<div class="form-group">