本文整理汇总了PHP中TActiveRecord::finder方法的典型用法代码示例。如果您正苦于以下问题:PHP TActiveRecord::finder方法的具体用法?PHP TActiveRecord::finder怎么用?PHP TActiveRecord::finder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TActiveRecord
的用法示例。
在下文中一共展示了TActiveRecord::finder方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SyncWithDimension
public function SyncWithDimension($sender, $param)
{
$cleanmodul = '';
$SQL = "SELECT * FROM " . $this->Tedsend_tabelle->Text . " WHERE parent_id" . $this->Tedsend_tabelle->Text . " = " . $this->Tedsend_id->Text;
$cleanmodul = preg_replace("/(^t[a-z]\\_)/", "", $this->Tedsend_tabelle->Text);
preg_match("/(_[a-z])/", $cleanmodul, $matches);
if (count($matches) >= 1) {
$cleanmodul = preg_replace("/(_[a-z])/", ucfirst(substr($matches[1], 1, 1)), $cleanmodul);
}
$finderclass = ucfirst($cleanmodul) . "Record";
$AllRecordsToWrite = TActiveRecord::finder($finderclass)->findAllBySql($SQL);
$fieldToTransfer = $this->Tedsend_field->Text;
if (count($AllRecordsToWrite) > 0) {
foreach ($AllRecordsToWrite as $SingleRecord) {
$criteria = new TActiveRecordCriteria();
$criteria->Condition = 'idta_stammdaten_group = :stammdaten_group AND stammdaten_key_extern = :key_extern';
$criteria->Parameters[':stammdaten_group'] = $this->Tedidta_stammdaten_group->Text;
$criteria->Parameters[':key_extern'] = $this->Tedsend_tabelle->Text . $SingleRecord->{'id' . $this->Tedsend_tabelle->Text};
$RecordToChange = StammdatenRecord::finder()->find($criteria);
if (count($RecordToChange) == 0) {
$RecordToChange = new StammdatenRecord();
}
$RecordToChange->idta_stammdaten_group = $this->Tedidta_stammdaten_group->Text;
$RecordToChange->stammdaten_key_extern = $this->Tedsend_tabelle->Text . $SingleRecord->{'id' . $this->Tedsend_tabelle->Text};
$RecordToChange->stammdaten_name = $SingleRecord->{$fieldToTransfer};
$RecordToChange->save();
unset($RecordToChange);
}
}
}
示例2: suggestUser
public function suggestUser($sender, $param)
{
// Get the token
$token = $param->getToken();
// Sender is the Suggestions repeater
$mySQL = "SELECT idtm_user,user_name FROM tm_user WHERE user_name LIKE '%" . $token . "%'";
$sender->DataSource = PFH::convertdbObjectSuggest(TActiveRecord::finder('UserRecord')->findAllBySQL($mySQL), array('idtm_user', 'user_name'));
$sender->dataBind();
}
示例3: suggestOrganisation
public function suggestOrganisation($sender, $param)
{
// Get the token
$token = $param->getToken();
// Sender is the Suggestions repeater
$mySQL = "SELECT idtm_organisation,org_name,org_vorname FROM tm_organisation WHERE org_name LIKE '%" . $token . "%'";
$sender->DataSource = PFH::convertdbObjectSuggest(TActiveRecord::finder('OrganisationRecord')->findAllBySQL($mySQL), array('idtm_organisation', 'org_name', 'org_vorname'));
$sender->dataBind();
}
示例4: test_find_by_sql_arb
function test_find_by_sql_arb()
{
$sql = 'SELECT c.name as category, i.name as item
FROM items i, categories c
WHERE i.category_id = c.category_id LIMIT 2';
$items = TActiveRecord::finder('SqlTest')->findBySql($sql);
$sql = "SELECT users.*, 'hello' as another_value FROM users LIMIT 2";
$users = TActiveRecord::finder('UserRecord2')->findBySql($sql);
var_dump($users);
}
示例5: test_finder_throw_exception_when_save
function test_finder_throw_exception_when_save()
{
$obj = TActiveRecord::finder('BaseRecordTest');
try {
$obj->save();
$this->fail();
} catch (TActiveRecordException $e) {
$this->pass();
}
}
示例6: finder
public static function finder($className = __CLASS__)
{
return parent::finder($className);
}
示例7: getForeignRecordFinder
/**
* @return TActiveRecord corresponding relationship foreign object finder instance.
*/
public function getForeignRecordFinder()
{
return TActiveRecord::finder($this->getForeignRecordClass());
}
示例8: getRecordFinder
/**
* @return TActiveRecord Active Record finder instance
*/
protected function getRecordFinder()
{
return TActiveRecord::finder($this->getRecordClass());
}
示例9: test_finder_returns_same_instance
function test_finder_returns_same_instance()
{
$obj1 = TActiveRecord::finder('BaseRecordTest');
$obj2 = TActiveRecord::finder('BaseRecordTest');
$this->assertSame($obj1, $obj2);
}
示例10: getStartNode
public function getStartNode($idtm_user, $modul, $planungssicht = 0)
{
//hier muss noch eine pruefung hin, wenn es mehrere treffer gibt...
if (count(BerechtigungRecord::finder()->find('idtm_user = ? AND xx_modul = ?', $idtm_user, $modul)) > 0) {
return BerechtigungRecord::finder()->find('idtm_user = ? AND xx_modul = ?', $idtm_user, $modul)->xx_id;
} else {
$SQL = "SELECT id" . $modul . " FROM " . $modul . " WHERE parent_id" . $modul . " = 0";
if ($planungssicht > 0) {
$SQL .= " AND idta_stammdatensicht = " . $planungssicht;
//gilt nur für die planung
}
$SQL .= " LIMIT 1";
$cleanmodul = preg_replace("/(^t[a-z]\\_)/", "", $modul);
preg_match("/(_[a-z])/", $cleanmodul, $matches);
if (count($matches) >= 1) {
$cleanmodul = preg_replace("/(_[a-z])/", ucfirst(substr($matches[1], 1, 1)), $cleanmodul);
}
$finderclass = ucfirst($cleanmodul) . "Record";
$Result = TActiveRecord::finder($finderclass)->findBySql($SQL);
if (count($Result) >= 1) {
$tmp = "id" . $modul;
return $Result->{$tmp};
} else {
return 1;
}
}
}