本文整理汇总了PHP中ElggEntity::save方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggEntity::save方法的具体用法?PHP ElggEntity::save怎么用?PHP ElggEntity::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElggEntity
的用法示例。
在下文中一共展示了ElggEntity::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Called before each test method.
*/
public function setUp()
{
_elgg_services()->hooks->backup();
$this->entity = new \ElggObject();
$this->entity->subtype = 'elgg_annotation_test';
$this->entity->access_id = ACCESS_PUBLIC;
$this->entity->save();
}
示例2: testSubtypeIsString
public function testSubtypeIsString()
{
$this->assertTrue($this->entity->save());
$guid = $this->entity->guid;
_elgg_invalidate_cache_for_entity($guid);
$this->entity = null;
$this->entity = get_entity($guid);
$this->assertEqual('elgg_entity_test_subtype', $this->entity->subtype);
}
示例3: setUp
/**
* Called before each test method.
*/
public function setUp()
{
$this->original_hooks = _elgg_services()->hooks;
_elgg_services()->hooks = new \Elgg\PluginHooksService();
$this->entity = new \ElggObject();
$this->entity->subtype = 'elgg_annotation_test';
$this->entity->access_id = ACCESS_PUBLIC;
$this->entity->save();
}
示例4: testSubtypePropertyReads
public function testSubtypePropertyReads()
{
$this->assertTrue($this->entity->save());
$guid = $this->entity->guid;
$subtype_prop = $this->entity->subtype;
$this->assertIsA($subtype_prop, 'int');
$this->assertEqual($subtype_prop, get_subtype_id('object', 'elgg_entity_test_subtype'));
_elgg_invalidate_cache_for_entity($guid);
$this->entity = null;
$this->entity = get_entity($guid);
$subtype_prop = $this->entity->subtype;
$this->assertIsA($subtype_prop, 'int');
$this->assertEqual($subtype_prop, get_subtype_id('object', 'elgg_entity_test_subtype'));
}
示例5: setUp
/**
* Called before each test method.
*/
public function setUp()
{
_elgg_services()->events->backup();
$this->entity1 = new ElggObject();
$this->entity1->subtype = 'elgg_relationship_test';
$this->entity1->access_id = ACCESS_PUBLIC;
$this->entity1->save();
$this->entity2 = new ElggObject();
$this->entity2->subtype = 'elgg_relationship_test';
$this->entity2->access_id = ACCESS_PUBLIC;
$this->entity2->save();
$this->entity3 = new ElggObject();
$this->entity3->subtype = 'elgg_relationship_test';
$this->entity3->access_id = ACCESS_PUBLIC;
$this->entity3->save();
}
示例6: setUp
/**
* Called before each test method.
*/
public function setUp()
{
$this->original_events = _elgg_services()->events;
_elgg_services()->events = new Elgg\EventsService();
$this->entity1 = new ElggObject();
$this->entity1->subtype = 'elgg_relationship_test';
$this->entity1->access_id = ACCESS_PUBLIC;
$this->entity1->save();
$this->entity2 = new ElggObject();
$this->entity2->subtype = 'elgg_relationship_test';
$this->entity2->access_id = ACCESS_PUBLIC;
$this->entity2->save();
$this->entity3 = new ElggObject();
$this->entity3->subtype = 'elgg_relationship_test';
$this->entity3->access_id = ACCESS_PUBLIC;
$this->entity3->save();
}
示例7: testSaveWithoutType
/**
* @expectedException InvalidParameterException
*/
public function testSaveWithoutType()
{
$db = $this->getMock('\\Elgg\\Database', array('getData', 'getTablePrefix', 'sanitizeString'), array(), '', false);
$db->expects($this->any())->method('sanitizeString')->will($this->returnArgument(0));
_elgg_services()->setValue('db', $db);
// requires type to be set
$this->obj->save();
}
示例8: update
/**
* Updates entity information with user input values
* @return \ElggEntity|false
*/
public function update()
{
hypePrototyper()->prototype->saveStickyValues($this->action);
// first handle attributes
foreach ($this->fields as $field) {
if ($field->getDataType() == 'attribute') {
$this->entity = $field->handle($this->entity);
}
}
if (!$this->entity->save()) {
return false;
}
foreach ($this->fields as $field) {
if ($field->getDataType() !== 'attribute') {
$this->entity = $field->handle($this->entity);
}
}
if (!$this->entity->save()) {
return false;
}
hypePrototyper()->prototype->clearStickyValues($this->action);
return $this->entity;
}
示例9: save
/**
* Saves this user to the database.
* @return true|false
*/
public function save()
{
// Save generic stuff
if (!parent::save()) {
return false;
}
// Now save specific stuff
return create_user_entity($this->get('guid'), $this->get('name'), $this->get('username'), $this->get('password'), $this->get('salt'), $this->get('email'), $this->get('language'), $this->get('code'));
}
示例10: save
/**
* Saves site-specific attributes.
*
* @internal Site attributes are saved in the sites_entity table.
*
* @return bool
*/
public function save()
{
global $CONFIG;
// Save generic stuff
if (!parent::save()) {
return false;
}
// make sure the site guid is set (if not, set to self)
if (!$this->get('site_guid')) {
$guid = $this->get('guid');
update_data("UPDATE {$CONFIG->dbprefix}entities SET site_guid={$guid}\n\t\t\t\tWHERE guid={$guid}");
}
// Now save specific stuff
return create_site_entity($this->get('guid'), $this->get('name'), $this->get('description'), $this->get('url'));
}
示例11: save
/**
* Override the save function.
*
* @return bool
*/
public function save()
{
// Save generic stuff
if (!parent::save()) {
return false;
}
// Now save specific stuff
_elgg_disable_caching_for_entity($this->guid);
$ret = create_group_entity($this->get('guid'), $this->get('name'), $this->get('description'));
_elgg_enable_caching_for_entity($this->guid);
return $ret;
}
示例12: save
/**
* Saves object-specific attributes.
*
* @internal Object attributes are saved in the objects_entity table.
*
* @return bool
*/
public function save()
{
// Save ElggEntity attributes
if (!parent::save()) {
return false;
}
// Save ElggObject-specific attributes
_elgg_disable_caching_for_entity($this->guid);
$ret = create_object_entity($this->get('guid'), $this->get('title'), $this->get('description'));
_elgg_enable_caching_for_entity($this->guid);
return $ret;
}
示例13: save
/**
* Override the save function.
* @return true|false
*/
public function save()
{
// Save generic stuff
if (!parent::save()) {
return false;
}
// Now save specific stuff
return create_object_entity($this->get('guid'), $this->get('title'), $this->get('description'), $this->get('container_guid'));
}
示例14: save
/**
* Override the save function.
*
* @return bool
*/
public function save()
{
// Save generic stuff
if (!parent::save()) {
return false;
}
// Now save specific stuff
return create_group_entity($this->get('guid'), $this->get('name'), $this->get('description'));
}
示例15: save
/** @override */
public function save()
{
global $CONFIG;
// Save generic stuff
$result = parent::save();
if (!$result) {
return false;
}
// make sure the site guid is set (if not, set to self)
if (!$this->get('site_guid')) {
$guid = (int) $this->get('guid');
update_data("UPDATE {$CONFIG->dbprefix}entities SET site_guid={$guid} WHERE guid={$guid}");
}
return $result;
}