本文整理汇总了PHP中Object::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::getId方法的具体用法?PHP Object::getId怎么用?PHP Object::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getViewPath
/**
* @param Object $obj
* @param string|null $thumbnail
* @return string
*/
public static function getViewPath($obj, $thumbnail = null)
{
switch ($obj) {
case $obj instanceof \User\Model\User:
if (!$obj->getCreatedDateTime()) {
return '/media/users/default/' . $obj->getId() . '/';
}
$datePath = DateBase::toFormat($obj->getCreatedDateTime(), 'Ymd');
return '/media/user/' . $datePath . '/' . $obj->getId() . '/' . $obj->getAvatar();
break;
}
return '';
}
示例2: get
public function get(Object $oObject, $aParams = array())
{
if (isset($this->aParams['ToModuleAlias'])) {
Core::import('Modules.' . $this->aParams['ToModuleAlias']);
}
$oMapper = Manager::getInstance()->getMapper($this->aParams['ToMapperAlias']);
$aContainer = $oMapper->getContainer();
$sTable = $aContainer['TableName'];
$sClassName = $aContainer['Object'];
$oQuery = new DbFetcher($sTable, 'a');
$oQuery->addJoinTable($this->aParams['TableName'], 'b', 'LEFT JOIN', 'a.id = b.' . $this->aParams['Field']);
$oQuery->addSelectField('a.*');
// Условия выборки
$oCriteria = new CriteriaGroup('AND');
$oCriteria->addElement(new CriteriaElement($this->aParams['Field2'], '=', (int) $oObject->getId()));
$oQuery->addCriteria($oCriteria->renderWhere());
if (isset($this->aParams['Order'])) {
foreach ($this->aParams['Order'] as $k => $dir) {
$oQuery->addOrder($k, $dir);
}
} else {
$oQuery->addOrder('Pos', 'ASC');
}
$oResult = new ObjectsCollection($oQuery);
$aResult = $oQuery->fetchAll();
foreach ($aResult as $itm) {
$oResult->add(new $sClassName($this->convRealFieldToFields($itm, '', $aContainer)));
}
return $oResult;
}
示例3: transform
/**
* Transforms an object to an id.
*
* @param Object|null $entity
* @return string
*/
public function transform($entity)
{
if (null === $entity) {
return "";
}
return $entity->getId();
}
示例4: objetVersEnregistrement
/**
* Prépare une liste de paramètres pour une requête SQL UPDATE ou INSERT
* @param Object $objetMetier
* @return array : tableau ordonné de valeurs
*/
public function objetVersEnregistrement($objetMetier)
{
// construire un tableau des paramètres d'insertion ou de modification
// l'ordre des valeurs est important : il correspond à celui des paramètres de la requête SQL
$retour = array(':id' => $objetMetier->getId(), ':libelle' => $objetMetier->getLibelle());
return $retour;
}
示例5: transform
/**
* Transforms an object to a string (id).
*
* @param Object|null $object
* @return string
*/
public function transform($object)
{
if (null === $object) {
return "";
}
return $object->getId();
}
示例6: transform
/**
* Transforms an object to a string (number).
*
* @param Object|null $entity
* @return string|null
*/
public function transform($entity)
{
if (!$entity) {
return null;
}
return $entity->getId();
}
示例7: get
public function get(Object $oObject, $aParams = array())
{
if (isset($this->aParams['ToModuleAlias'])) {
Core::import('Modules.' . $this->aParams['ToModuleAlias']);
}
$oMapper = Manager::getInstance()->getMapper($this->aParams['ToMapperAlias']);
$nLimit = 0;
$nOffset = 0;
$aLocCriteria = array($this->aParams['Field'] => $oObject->getId());
$aLocOrder = array('Pos' => 'ASC');
if (count($aParams) > 0) {
if (isset($aParams['Criteria'])) {
foreach ($aParams['Criteria'] as $key => $val) {
$aLocCriteria[$key] = $val;
}
}
if (isset($aParams['Order'])) {
$aLocOrder = $aParams['Order'];
}
if (isset($aParams['Limit'])) {
$nLimit = intval($aParams['Limit']);
}
if (isset($aParams['Offset'])) {
$nOffset = intval($aParams['Offset']);
}
}
$aDefaultParams = isset($this->aParams['Params']) ? $this->aParams['Params'] : array();
return $oMapper->find(ArrayHelper::merge($aDefaultParams, array('Order' => $aLocOrder, 'Criteria' => $aLocCriteria, 'Limit' => $nLimit, 'Offset' => $nOffset)));
}
示例8: get
public function get(Object $oObject, $aParams = array())
{
if (isset($this->aParams['ToModuleAlias'])) {
Core::import('Modules.' . $this->aParams['ToModuleAlias']);
}
$oMapper = Manager::getInstance()->getMapper($this->aParams['ToMapperAlias']);
$aParams['Criteria'][$this->aParams['Field']] = $oObject->getId();
return $oMapper->findFirst($aParams);
}
示例9: preparaDados
/**
* Prepara os dados para o cancelamento da nota
* @param string $sParametroArquivo
*/
public function preparaDados($sParametroArquivo)
{
$this->oDadosXML = $this->validaXML($sParametroArquivo);
/**
* Verifica se existe inconsistencias
*/
if (count($this->aInconsistencias) == 0) {
$sCnpj = (string) $this->oDadosXML->IdentificacaoNfse->Cnpj;
$sNumero = (string) $this->oDadosXML->IdentificacaoNfse->Numero;
$iInscricaoMunicipal = (string) $this->oDadosXML->IdentificacaoNfse->InscricaoMunicipal;
$iNumero = (int) substr($sNumero, 4, 11);
$aAtributosContriobuinte = array("cnpj_cpf" => $sCnpj, "im" => $iInscricaoMunicipal);
$sAmbiente = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
if (DBSeller_Plugin_Auth::checkPermissionWebservice($sCnpj, "webservice/{$sAmbiente}/recepcionar-lote-rps")) {
$aContribuinte = Administrativo_Model_UsuarioContribuinte::getByAttributes($aAtributosContriobuinte);
foreach ($aContribuinte as $oContribuinte) {
$this->oContribuinte = $oContribuinte;
}
/**
* Verifica se existe contribuinte com o CNPJ e Inscrição Municipal informado
*/
if (empty($this->oContribuinte)) {
$this->adicionarInconsistencia('E44');
$this->adicionarInconsistencia('E50');
} else {
$iIdContribuinte = $this->oContribuinte->getId();
$aAtributosNota = array("id_contribuinte" => $iIdContribuinte, "nota" => $iNumero);
/**
* Retornar a entidade do array de notas
*/
$aNotas = Contribuinte_Model_Nota::getByAttributes($aAtributosNota);
foreach ($aNotas as $oNota) {
$this->oNota = $oNota;
}
/**
* Verifica se existe nota
*/
if (empty($this->oNota)) {
$this->adicionarInconsistencia('E78');
} else {
$bNotaCancelada = $this->oNota->getCancelada();
/**
* Verifica se a nota já está cancelada
*/
if ($bNotaCancelada) {
$this->adicionarInconsistencia('E79');
}
}
}
} else {
$this->adicionarInconsistencia('E157');
$this->adicionarInconsistencia('Usuário sem permissão!');
}
}
}
示例10: getTicket
/**
* Get a specific ticket
* @param Object $realm
* @param Int $ticketId
* @return Array
*/
public function getTicket($realm, $ticketId = false)
{
if ($ticketId && $realm) {
//Connect to the realm
$realm->getCharacters()->connect();
//Do the query
$query = $realm->getCharacters()->getConnection()->query("SELECT " . allColumns("gm_tickets", $realm->getId()) . " FROM " . table("gm_tickets", $realm->getId()) . " WHERE " . column("gm_tickets", "ticketId", false, $realm->getId()) . " = ?", array($ticketId));
if ($realm->getCharacters()->getConnection()->_error_message()) {
die($realm->getCharacters()->getConnection()->_error_message());
}
if ($query->num_rows() > 0) {
$result = $query->result_array();
return $result[0];
} else {
return false;
}
} else {
return false;
}
}
示例11: getFile
/**
* Returns file model.
* @return null|Object|File
*/
public function getFile()
{
if (!$this->objectId) {
return null;
}
if (isset($this->file) && $this->objectId == $this->file->getId()) {
return $this->file;
}
//todo Here we can load anything (Folder or File). But now - only File model
$this->file = File::loadById($this->objectId);
return $this->file;
}
示例12: _loadObject
/**
* (non-PHPdoc)
* @see \comhon\object\object\SerializationUnit::_loadObject()
*/
protected function _loadObject(Object $pObject)
{
$lId = $pObject->getId();
$lPath = $this->getValue("saticPath") . DIRECTORY_SEPARATOR . $lId . DIRECTORY_SEPARATOR . $this->getValue("staticName");
if (!file_exists($lPath)) {
throw new \Exception("cannot load json file, file doesn't exists (id : {$lId})");
}
$lStdClassObject = json_decode(file_get_contents($lPath));
if ($lStdClassObject !== false) {
$pObject->fromObject($lStdClassObject);
return true;
} else {
return false;
}
}
示例13: _loadObject
/**
* (non-PHPdoc)
* @see \comhon\object\object\SerializationUnit::_loadObject()
*/
protected function _loadObject(Object $pObject)
{
$lId = $pObject->getId();
$lPath = $this->getValue("saticPath") . DIRECTORY_SEPARATOR . $lId . DIRECTORY_SEPARATOR . $this->getValue("staticName");
if (!file_exists($lPath)) {
throw new \Exception("cannot load xml file, file doesn't exists (id : {$lId})");
}
$lSimpleXmlElement = simplexml_load_file($lPath);
if ($lSimpleXmlElement !== false && !is_null($lSimpleXmlElement)) {
$pObject->fromXml($lSimpleXmlElement);
return true;
} else {
return false;
}
}
示例14: generateXml
/**
* Generate the record node for
* the data node
* @param DOMDocument $doc
* @param DOMNode $parentNode
* @param Object $record
*/
public function generateXml($doc, $parentNode, $record)
{
$tagRecord = $doc->createElement('record');
$tagRecord->setAttribute('id', $record->getId());
$previous = array();
foreach ($this->fields as $field) {
if (!in_array($field->completeName(), $previous)) {
$tag = $doc->createElement($field->completeName());
$text = $doc->createTextNode($field->getValue($record));
$tag->appendChild($text);
$tagRecord->appendChild($tag);
}
$previous[count($previous)] = $field->getName();
}
$text = $parentNode->appendChild($tagRecord);
}
示例15: get
public function get(Object $oObject, $aParams = array())
{
if (isset($this->aParams['ToModuleAlias'])) {
Core::import('Modules.' . $this->aParams['ToModuleAlias']);
}
$oMapper = Manager::getInstance()->getMapper($this->aParams['ToMapperAlias']);
$aLocCriteria = array($this->aParams['Field'] => $oObject->getId());
if (!empty($aParams)) {
if (isset($aParams['Criteria'])) {
foreach ($aParams['Criteria'] as $key => $val) {
$aLocCriteria[$key] = $val;
}
}
}
$nRelation = $oMapper->findStat('count', 'c', isset($this->aParams['FunctionParams']) ? $this->aParams['FunctionParams'] : '*', array('Criteria' => $aLocCriteria));
return $nRelation;
}