本文整理汇总了PHP中Account::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::getId方法的具体用法?PHP Account::getId怎么用?PHP Account::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMakeWithProperties
/**
* Создать счет с набором свойств
*/
public function testMakeWithProperties()
{
$data = array('user_id' => $this->helper->makeUser()->getId(), 'name' => 'Название счета', 'type_id' => 5, 'currency_id' => 1, 'Properties' => array($prop1 = array('field_id' => 10, 'field_value' => 'Значение 1'), $prop2 = array('field_id' => 20, 'field_value' => 'Значение 2')));
$acc = new Account();
$acc->fromArray($data, $deep = true);
$acc->save();
$prop1['account_id'] = $prop2['account_id'] = $acc->getId();
$this->assertEquals(1, $this->queryFind('AccountProperty', $prop1)->count(), 'Prop 1');
$this->assertEquals(1, $this->queryFind('AccountProperty', $prop2)->count(), 'Prop 1');
}
示例2: do_add
/**
* Adds a new acccount
*
* @param string $strName
* @param int $intDomainId
* @param string $strPassword
* @return int The user ID
*/
public function do_add($strName, $intDomainId, $strPassword)
{
$strName = strtolower($strName);
// Only letters, numbers and the dash symbol are allowed!
if (preg_match('/[^a-z0-9\\-]/', $strName) !== 0 || strlen($strName) > 45) {
throw new Exception('Invalid account name');
}
$account = new Account();
$account->setName($strName)->save();
return $account->getId();
}
示例3: all_stats
public static function all_stats(Account $account, $ids, $metricGroups, $params = [])
{
$endTime = isset($params['end_time']) ? $params['end_time'] : new \DateTime('now');
$endTime->setTime($endTime->format('H'), 0, 0);
$startTime = isset($params['start_time']) ? $params['start_time'] : new \DateTime($endTime->format('c') . " - 7 days");
$startTime->setTime($startTime->format('H'), 0, 0);
$granularity = isset($params['granularity']) ? $params['granularity'] : Enumerations::GRANULARITY_HOUR;
$placement = isset($params['placement']) ? $params['placement'] : Enumerations::PLACEMENT_ALL_ON_TWITTER;
$segmentationType = isset($params['segmentation_type']) ? $params['segmentation_type'] : null;
$params = ['metric_groups' => implode(",", $metricGroups), 'start_time' => $startTime->format('c'), 'end_time' => $endTime->format('c'), 'granularity' => $granularity, 'entity' => static::ENTITY, 'entity_ids' => implode(",", $ids), 'placement' => $placement];
if (!is_null($segmentationType)) {
$params['segmentation_type'] = $segmentationType;
}
$resource = str_replace(static::RESOURCE_REPLACE, $account->getId(), static::RESOURCE_STATS);
$response = $account->getTwitterAds()->get($resource, $params);
return $response->getBody()->data;
}
示例4: VALUES
function __construct(Schema $schema, Account $account)
{
$this->accountId = $account->getId();
$mySQLi = $schema->getMySQLi();
$queryString = "INSERT " . DbConstants::TABLE_AUDIT . " (id_account) VALUES('" . $this->accountId . "')";
$queryResult = $mySQLi->query($queryString);
if (!$queryResult) {
throw new Exception("Error creating audit object for account[" . $this->accountId . "] - " . $mySQLi->error . "\n<!--\n{$queryString}\n-->");
}
$this->id = $mySQLi->insert_id;
// Get the timestamp of the created audit object.
$queryString = "SELECT a.at FROM " . DbConstants::TABLE_AUDIT . " a WHERE a.id = {$this->id}";
$queryResult = $mySQLi->query($queryString);
if (!$queryResult) {
throw new Exception("Error fetching audit[" . $this->accountId . "] - " . $mySQLi->error . "\n<!--\n{$queryString}\n-->");
}
$audit = $queryResult->fetch_assoc();
$this->at = $audit['at'];
$queryResult->close();
}
示例5: __construct
public function __construct($arrayAccounts)
{
// browse through list
$collection = array();
if ($arrayAccounts) {
foreach ($arrayAccounts as $arrayAccount) {
$account = new Account();
$account->setId($arrayAccount['name_value_list']['id']);
$account->setName(htmlspecialchars_decode($arrayAccount['name_value_list']['name'], ENT_QUOTES));
$account->setAssignedAt($arrayAccount['name_value_list']['assigned_user_name']);
$account->setidLMB($arrayAccount['name_value_list']['id_compte_lundi_matin_c']);
$collection[$account->getId()] = $account;
}
// Sort accounts by name
usort($collection, function ($a, $b) {
return strcmp($a->getName(), $b->getName());
});
}
// build ArrayObject using collection
return parent::__construct($collection);
}
示例6: setAccountId
/**
* sets account_id
*
* @param Account|int|null $account
*
* @return $this
*/
public function setAccountId($account)
{
$this->account_id = $account instanceof Account ? $account->getId() : $account;
return $this;
}
示例7: Account
<?php
require "account.php";
if (!empty($_POST['id']) && !empty($_POST['value'])) {
if (is_numeric($_POST['id']) && is_numeric($_POST['value'])) {
$acc = new Account($_POST['id']);
$acc->setTotal($_POST['value']);
echo "Values updated: \n";
echo "ID: " . $acc->getId() . "\n";
echo "Name: " . $acc->getAccName() . "\n";
echo "Value: " . $acc->getTotal() . "\n";
echo "Last Update: " . $acc->getLastUpdate() . "\n";
}
}
示例8: _makeBlanceOpeationArray
/**
* Создать массив свойств балансовой операции
*/
public function _makeBlanceOpeationArray(User $user, Account $account, $balance = 0)
{
return array('user_id' => $user->getId(), 'account_id' => $account->getId(), 'category_id' => null, 'amount' => $balance, 'date' => '0000-00-00', 'type' => Operation::TYPE_BALANCE, 'comment' => 'Начальный остаток', 'accepted' => 1);
}
示例9: Account
$parsedBody = $request->getParsedBody();
if ($parsedBody == null) {
return err_general_error($response, "Provide a body to create a new account");
}
$account = new Account();
$account->fromArray($parsedBody);
$account->setSalt(openssl_random_pseudo_bytes(32));
#$account->salt = "123";
$account->setPassword(hash('sha512', $account->getPassword() . $account->getSalt()));
if ($account->validate()) {
if ($account->save()) {
session_start();
#session_unset();
#session_regenerate_id(true);
$_SESSION['Username'] = $account->getUsername();
$_SESSION['Id'] = $account->getId();
$_SESSION['loggedin'] = true;
/* Response with resulting account */
$response->getBody()->write($account->toJSON());
return $response;
}
} else {
return err_general_error($response, "Validation failed");
}
/* Response with resulting account */
$response->getBody()->write($account->toJSON());
return $response;
});
})->add('HeaderMiddleware');
// Define the private group */
$app->group('/public', function () use($app) {
示例10: testAccountHasAnId
public function testAccountHasAnId()
{
$account = new Account($this->testAccountId);
$this->assertGreaterThan(0, $account->getId());
}
示例11: addInstanceToPool
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Account $obj A Account object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
AccountPeer::$instances[$key] = $obj;
}
}
示例12: getAll
/**
* Returns an associative array of defined properties.
*
* If a property has no value specified, its default value is returned.
*
* @param Account $account
* @param Domain $domain Optional. Default is NULL.
* @param User $user Optional. Default is NULL.
* @param array $filter Optional. An array with names of properties to
* retrieve values for. If NULL, all values will be returned.
* Default is NULL.
* @param PropelPDO $con Optional. The database connection to use.
* Default is NULL.
* @return array An associative array mapping property names to values as
* obtained by {@link PropertyValue::get()}.
*/
public static function getAll(Account $account, Domain $domain = null, User $user = null, array $filter = null, PropelPDO $con = null)
{
$accountId = $account->getId();
$domainId = $domain === null ? null : $domain->getId();
$userId = $user === null ? null : $user->getId();
$query = self::createPropertyValueQuery($accountId, $domainId, $userId);
if ($filter !== null) {
$query->add(PropertyPeer::NAME, $filter, Criteria::IN);
}
$values = $query->find($con);
$values->populateRelation('Property', null, $con);
$accountValues = self::getDefaults($account, $con);
$domainValues = array();
$userValues = array();
foreach ($values as $value) {
$property = $value->getProperty($con);
$name = $property->getName();
if ($value->getUserId() === $userId) {
$userValues[$name] = $value->get($con);
} elseif ($value->getDomainId() === $domainId and $domainId !== null) {
$domainValues[$name] = $value->get($con);
} elseif ($property->getAccountId() === $accountId and $accountId !== null) {
$accountValues[$name] = $value->get($con);
}
}
$result = $userValues + $domainValues + $accountValues;
ksort($result);
return $result;
}
示例13: header
///// パスワードの確認
$login = false;
if ($autologin) {
if ($password == $account->getCookieLock()) {
$login = true;
}
} else {
if (Utils::encrpytPassword($password, $account->getSalt()) == $account->getEncryptedPassword()) {
$login = true;
}
}
///// パスワードの確認が完了し、 ログインができます。
if ($login) {
// 認証済み?
if (!$account->isValidated()) {
header('Location: /account/verifyplease?accountid=' . $account->getId());
die;
}
if ($rememberMe || $autologin) {
setAutoLogin($account);
}
$data = $account->throwData();
unset($data['salt']);
unset($data['password']);
unset($data['validate_code']);
unset($data['validated']);
$_SESSION[KEY_SESSION] = $data;
// successfully login
// logging login here
$text1 = "pc";
if (Utils::is_mobile()) {
示例14: parseAccount
function parseAccount($eId, $cmd)
{
global $_PATHS, $_CONF, $objUpload, $objLiveAdmin;
$objTpl = new HTML_Template_IT($_PATHS['templates']);
$objTpl->loadTemplatefile("account.tpl.htm");
switch ($cmd) {
case CMD_EDIT:
$strDispatch = Request::get('dispatch');
$intPermId = Request::get('frm_userid');
$strPunchId = Request::get('frm_punchid');
$strName = Request::get('frm_name');
$strDomain = Request::get('frm_uri');
$strUserName = Request::get('frm_account_name');
$strUserPass = Request::get('frm_account_pass');
$strUserEmail = Request::get('frm_account_email');
//$arrProducts = Request::get('frm_account_product', array());
$objAccount = Account::selectByPk($eId);
if ($strDispatch == "editAccount") {
if (is_object($objAccount)) {
$objAccount->setName($strName);
$objAccount->setUri($strDomain);
$objAccount->save();
//*** Set products.
$objAccount->clearProducts();
/*
foreach ($arrProducts as $intProduct) {
$objAccount->addProduct($intProduct);
}
*/
$objAccount->addProduct(1);
//*** Edit Admin user.
$data = array('name' => $strUserName, 'email' => $strUserEmail);
if (!empty($strUserPass)) {
$data['passwd'] = $strUserPass;
}
$objLiveAdmin->updateUser($data, $intPermId);
$objTpl->setCurrentBlock("text");
$objTpl->setVariable('BODY', "<p>Account saved successfully.</p>");
$objTpl->parseCurrentBlock();
}
} else {
if (is_object($objAccount)) {
$strAdminName = "";
$strAdminEmail = "";
//*** Admin user.
$filters = array('container' => 'auth', 'filters' => array('account_id' => array($objAccount->getId())));
$objUsers = $objLiveAdmin->getUsers($filters);
if (is_array($objUsers)) {
foreach ($objUsers as $objUser) {
if ($objUser["perm_type"] == 4) {
$strAdminName = $objUser["name"];
$strAdminEmail = $objUser["email"];
$intPermId = $objUser["perm_user_id"];
break;
}
}
}
$objTpl->setCurrentBlock("form.field.punchid");
$objTpl->setVariable('PUNCH_ID_VALUE', $objAccount->getPunchId());
$objTpl->parseCurrentBlock();
/*
$objProducts = Product::getProducts();
$objAccountProducts = AccountProduct::getByAccountId($objAccount->getId());
foreach ($objProducts as $objProduct) {
$objTpl->setCurrentBlock("form.field.product");
$objTpl->setVariable('ID', $objProduct->getId());
$objTpl->setVariable('LABEL', $objProduct->getName());
$objTpl->setVariable('VALUE', $objProduct->getId());
foreach ($objAccountProducts as $objAccountProduct) {
if ($objAccountProduct->getProductId() == $objProduct->getId()) {
$objTpl->setVariable('CHECKED', "checked=\"checked\"");
}
}
$objTpl->parseCurrentBlock();
}
*/
$objTpl->setCurrentBlock("form.edit");
$objTpl->setVariable('NAME_VALUE', $objAccount->getName());
$objTpl->setVariable('URI_VALUE', $objAccount->getUri());
$objTpl->setVariable('ACCOUNT_NAME_VALUE', $strAdminName);
$objTpl->setVariable('ACCOUNT_EMAIL_VALUE', $strAdminEmail);
$objTpl->setVariable('USER_ID', $intPermId);
$objTpl->setVariable('CID', NAV_ACCOUNT);
$objTpl->setVariable('EID', $eId);
$objTpl->setVariable('CMD', $cmd);
$objTpl->parseCurrentBlock();
}
}
break;
case CMD_ADD:
$strDispatch = Request::get('dispatch');
$strName = Request::get('frm_name');
$strDomain = Request::get('frm_uri');
$strUserName = Request::get('frm_account_name');
$strUserPass = Request::get('frm_account_pass');
$strUserEmail = Request::get('frm_account_email');
//$arrProducts = Request::get('frm_account_product');
if ($strDispatch == "editAccount") {
//.........这里部分代码省略.........
示例15: filterByAccount
/**
* Filter the query by a related Account object
*
* @param Account|PropelObjectCollection $account The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return PropertyQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAccount($account, $comparison = null)
{
if ($account instanceof Account) {
return $this->addUsingAlias(PropertyPeer::ACCOUNT_ID, $account->getId(), $comparison);
} elseif ($account instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(PropertyPeer::ACCOUNT_ID, $account->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByAccount() only accepts arguments of type Account or PropelCollection');
}
}