本文整理汇总了PHP中Document::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Document::getId方法的具体用法?PHP Document::getId怎么用?PHP Document::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document
的用法示例。
在下文中一共展示了Document::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDependencyForFrontend
/**
* @param Document|Asset|Object_Abstract $element
* @return array
*/
public static function getDependencyForFrontend($element)
{
if ($element instanceof Document) {
return array("id" => $element->getId(), "path" => $element->getFullPath(), "type" => "document", "subtype" => $element->getType());
} else {
if ($element instanceof Asset) {
return array("id" => $element->getId(), "path" => $element->getFullPath(), "type" => "asset", "subtype" => $element->getType());
} else {
if ($element instanceof Object_Abstract) {
return array("id" => $element->getId(), "path" => $element->getFullPath(), "type" => "object", "subtype" => $element->geto_Type());
}
}
}
}
示例2: copyRecursive
/**
* @param Document $target
* @param Document $source
* @return Document copied document
*/
public function copyRecursive($target, $source)
{
// avoid recursion
if (!$this->_copyRecursiveIds) {
$this->_copyRecursiveIds = array();
}
if (in_array($source->getId(), $this->_copyRecursiveIds)) {
return;
}
if ($source instanceof Document_Page || $source instanceof Document_Snippet) {
$source->getElements();
}
$source->getProperties();
$new = clone $source;
$new->id = null;
$new->setChilds(null);
$new->setKey(Element_Service::getSaveCopyName("document", $new->getKey(), $target));
$new->setParentId($target->getId());
$new->setUserOwner($this->_user->getId());
$new->setUserModification($this->_user->getId());
$new->setResource(null);
$new->setLocked(false);
$new->save();
// add to store
$this->_copyRecursiveIds[] = $new->getId();
foreach ($source->getChilds() as $child) {
$this->copyRecursive($new, $child);
}
$this->updateChilds($target, $new);
return $new;
}
示例3: testSetGetId
public function testSetGetId()
{
$document = new Document($this->mandango);
$this->assertNull($document->getId());
$id = new \MongoId('123');
$this->assertSame($document, $document->setId($id));
$this->assertSame($id, $document->getId());
}
示例4: export
public static function export(Document $document)
{
$json = db::query('SELECT creation_date, data FROM snapshots WHERE document = ' . db::value($document->getId()) . ' ORDER BY creation_date DESC');
foreach ($json as $i => $row) {
$json[$i]['data'] = json_decode($row['data']);
}
return $json;
}
示例5: testSetGetId
public function testSetGetId()
{
$document = new Document($this->mongator);
$this->assertNull($document->getId());
$id = new \MongoId('4af9f23d8ead0e1d32000000');
$this->assertSame($document, $document->setId($id));
$this->assertSame($id, $document->getId());
}
示例6: newWordsAction
public function newWordsAction($data = array())
{
$req = new Request();
$doc = -1;
$doc = new Document(-1);
$data = array('docId' => $doc->getId(), 'docWords' => $doc->getWords(), 'prevWords' => '');
return json_encode($data);
}
示例7: testSetGetId
public function testSetGetId()
{
$document = new Document($this->mandango);
$this->assertNull($document->getId());
$id = new \MongoDB\BSON\ObjectID($this->generateObjectId());
$this->assertSame($document, $document->setId($id));
$this->assertSame($id, $document->getId());
}
示例8: saveAttachment
public function saveAttachment(Document $document, $attachment)
{
$attachment_parts = pathinfo($attachment);
$basename = $attachment_parts['basename'];
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$contentType = finfo_file($finfo, $attachment);
$id = $document->getId();
if (empty($id)) {
$document->setId($document->getFields()['_id']);
}
$uri = sprintf('%s/%s/%s?rev=%s', $this->client->getDatabase(), $document->getId(), $basename, $document->getRevision());
try {
$response = $this->parseResponse($this->curl->put($this->client->getPath($uri), file_get_contents($attachment), $contentType));
} catch (\Exception $e) {
return $e->getMessage();
}
return $response;
}
示例9: enrich
/**
*
* @return boolean
*/
public function enrich()
{
$this->checkValuesQuery();
foreach ($this->properties as $xpath => $prop) {
self::$valuesQuery->execute(array($this->document->getId(), $xpath, $this->tokenId));
while ($value = self::$valuesQuery->fetch(\PDO::FETCH_OBJ)) {
$user = $this->createTeiFeature('user', $value->user_id);
$date = $this->createTeiFeature('date', $value->date);
$xpath = $this->createTeiFeature('property_xpath', $xpath);
$val = $this->createTeiFeature('value', $value->value);
$fs = $this->createTeiFeatureSet();
$fs->appendChild($user);
$fs->appendChild($date);
$fs->appendChild($xpath);
$fs->appendChild($val);
if ($prop->nodeType !== XML_ELEMENT_NODE) {
$prop->parentNode->appendChild($fs);
} else {
$prop->appendChild($fs);
}
}
}
return $this->updateDocument();
}
示例10: getByPath
/**
* Static helper to get a Document by it's path, only type Document is returned, not Document_Page, ... (see getConcreteByPath() )
*
* @param string $path
* @return Document
*/
public static function getByPath($path)
{
$path = Element_Service::correctPath($path);
try {
$document = new Document();
// validate path
if (Pimcore_Tool::isValidPath($path)) {
$document->getResource()->getByPath($path);
}
return self::getById($document->getId());
} catch (Exception $e) {
Logger::warning($e);
}
return null;
}
示例11: assert
/**
* This is the constructor for the KTAPI_Document
*
* @author KnowledgeTree Team
* @access private
* @param KTAPI $ktapi The KTAPI object
* @param KTAPI_Folder $ktapi_folder The parent folder object
* @param Document $document The internal document object
* @return KTAPI_Document
*/
function KTAPI_Document(&$ktapi, &$ktapi_folder, &$document)
{
assert($ktapi instanceof KTAPI);
//is_a($ktapi,'KTAPI'));
assert(is_null($ktapi_folder) || $ktapi_folder instanceof KTAPI_Folder);
//is_a($ktapi_folder,'KTAPI_Folder'));
$this->ktapi =& $ktapi;
$this->ktapi_folder =& $ktapi_folder;
$this->document =& $document;
$this->documentid = $document->getId();
}
示例12: 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 Document $obj A Document 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
DocumentPeer::$instances[$key] = $obj;
}
}
示例13: setDocument
/**
* Declares an association between this object and a Document object.
*
* @param Document $v
* @return DocumentationPart The current object (for fluent API support)
* @throws PropelException
*/
public function setDocument(Document $v = null)
{
if ($v === null) {
$this->setImageId(NULL);
} else {
$this->setImageId($v->getId());
}
$this->aDocument = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Document object, it will not be re-added.
if ($v !== null) {
$v->addDocumentationPart($this);
}
return $this;
}
示例14: allowDocumentRelation
/**
*
* Checks if an document is an allowed relation
* @param Document $document
* @return boolean
*/
protected function allowDocumentRelation($document)
{
$allowedDocumentTypes = $this->getDocumentTypes();
$allowed = true;
if (!$this->getDocumentsAllowed()) {
$allowed = false;
} else {
if ($this->getDocumentsAllowed() and is_array($allowedDocumentTypes) and count($allowedDocumentTypes) > 0) {
//check for allowed asset types
foreach ($allowedDocumentTypes as $t) {
$allowedTypes[] = $t['documentTypes'];
}
if (!in_array($document->getType(), $allowedTypes)) {
$allowed = false;
}
} else {
//don't check if no allowed document types set
}
}
\Logger::debug("checked object relation to target document [" . $document->getId() . "] in field [" . $this->getName() . "], allowed:" . $allowed);
return $allowed;
}
示例15: removeDocument
/**
* Удаляет документ из БД
* @global \TDataBase $DB
* @param \Document $doc
*/
static function removeDocument(&$doc)
{
global $DB;
$sql = 'DELETE FROM ' . TRUSTED_DB_TABLE_DOCUMENTS . ' ' . 'WHERE ID = ' . $doc->getId();
$DB->Query($sql);
TDataBaseDocument::saveDocumentParent($doc);
}