本文整理汇总了PHP中Feature::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Feature::getId方法的具体用法?PHP Feature::getId怎么用?PHP Feature::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feature
的用法示例。
在下文中一共展示了Feature::getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ensureConsistency
/**
* Checks and repairs the internal consistency of the object.
*
* This method is executed after an already-instantiated object is re-hydrated
* from the database. It exists to check any foreign keys to make sure that
* the objects related to the current object are correct based on foreign key.
*
* You can override this method in the stub class, but you should always invoke
* the base method from the overridden method (i.e. parent::ensureConsistency()),
* in case your model changes.
*
* @throws PropelException
*/
public function ensureConsistency()
{
if ($this->aCategory !== null && $this->category_id !== $this->aCategory->getId()) {
$this->aCategory = null;
}
if ($this->aFeature !== null && $this->feature_id !== $this->aFeature->getId()) {
$this->aFeature = null;
}
}
示例2: treasurehunt_update_geometry_and_position_of_stage
/**
* Updates the position and/or geometry of a stage in a road by updating
* treasurehunt_stages table. Then, check if road is valid.
*
* @see treasurehunt_set_valid_road()
* @param Feature $feature The feature with the id, position, road and geometry of the stage.
* @param stdClass $context The context object.
*/
function treasurehunt_update_geometry_and_position_of_stage(Feature $feature, $context)
{
global $DB;
$stage = new stdClass();
$stage->position = $feature->getProperty('stageposition');
$stage->roadid = $feature->getProperty('roadid');
$geometry = $feature->getGeometry();
$stage->geom = treasurehunt_geometry_to_wkt($geometry);
$stage->timemodified = time();
$stage->id = $feature->getId();
$parms = array('id' => $stage->id);
$entry = $DB->get_record('treasurehunt_stages', $parms, 'id,position', MUST_EXIST);
// It can not be change the position of stage once the road is blocked.
if (treasurehunt_check_road_is_blocked($stage->roadid) && $stage->position != $entry->position) {
print_error('notchangeorderstage', 'treasurehunt');
}
// It can not be save an existing stage without geometry.
if (count($geometry->getComponents()) === 0) {
print_error('saveemptyridle', 'treasurehunt');
}
$DB->update_record('treasurehunt_stages', $stage);
// Check if road is valid.
treasurehunt_set_valid_road($stage->roadid);
// Trigger update stage event.
$eventparams = array('context' => $context, 'objectid' => $stage->id);
\mod_treasurehunt\event\stage_updated::create($eventparams)->trigger();
}
示例3: getAllFeatures
/**
* @return Feature[]
*/
public static function getAllFeatures()
{
global $wpdb;
$features = array();
$rows = $wpdb->get_results("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . $wpdb->prefix . "squirrels_features\n\t\t\tORDER BY\n\t\t\t\ttitle ASC");
foreach ($rows as $row) {
$feature = new Feature();
$feature->loadFromRow($row);
$features[$feature->getId()] = $feature;
}
return $features;
}
示例4: setFeature
/**
* Declares an association between this object and a Feature object.
*
* @param Feature $v
* @return ActivityHasFeature The current object (for fluent API support)
* @throws PropelException
*/
public function setFeature(Feature $v = null)
{
if ($v === null) {
$this->setFeatureId(NULL);
} else {
$this->setFeatureId($v->getId());
}
$this->aFeature = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Feature object, it will not be re-added.
if ($v !== null) {
$v->addActivityHasFeature($this);
}
return $this;
}
示例5: deleteFeature
/**
* AJAX action for deleting feature.
*/
public function deleteFeature()
{
$feature = new Feature($_REQUEST['id']);
$feature->delete();
//Since delete doesn't return anything, this will check for success
return $feature->getId() == NULL;
}
示例6: 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 Feature $value A Feature object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Feature $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}