本文整理汇总了PHP中Activity::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::getId方法的具体用法?PHP Activity::getId怎么用?PHP Activity::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity::getId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_1_1_1
public function test_1_1_1()
{
$Activity = new Activity(array('name' => 'Test'));
$Child = new Kid(array('name' => 'Johanna'));
$Father = new Father(array('name' => 'Daddy'));
$Child->father->assign($Father);
$Activity->kid->assign($Child);
$Child->save();
$Activity->save();
$Test = $Activity->findFirstBy('name', 'Test', array('conditions' => 'id=' . $Activity->getId(), 'include' => array('kid' => array('conditions' => 'id=' . $Child->getId(), 'include' => array('father' => array('conditions' => 'id=' . $Father->getId()))))));
$this->assertEqual($Test->name, 'Test');
$this->assertEqual($Test->kid->name, 'Johanna');
$this->assertEqual($Test->kid->father->name, 'Daddy');
// die;
//binds not working properly
$Test = $Activity->findFirstBy('name', 'Test', array('conditions' => 'id=?', 'bind' => $Test->getId(), 'include' => array('kid' => array('conditions' => 'id=?', 'bind' => $Child->getId(), 'include' => array('father' => array('conditions' => 'id=?', 'bind' => array($Father->getId())))))));
$this->assertEqual($Test->name, 'Test');
$this->assertEqual($Test->kid->name, 'Johanna');
$this->assertEqual($Test->kid->father->name, 'Daddy');
//die;
}
示例2: 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 Activity $value A Activity object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Activity $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}
示例3: deleteActivityProfile
public function deleteActivityProfile($activity, $id)
{
if (!$activity instanceof Activity) {
$activity = new Activity($activity);
}
$response = $this->sendRequest('DELETE', 'activities/profile', array('params' => array('activityId' => $activity->getId(), 'profileId' => $id)));
return $response;
}
示例4: setActivity
/**
* Declares an association between this object and a Activity object.
*
* @param Activity $v
* @return ActivityHasFeature The current object (for fluent API support)
* @throws PropelException
*/
public function setActivity(Activity $v = null)
{
if ($v === null) {
$this->setActivityId(NULL);
} else {
$this->setActivityId($v->getId());
}
$this->aActivity = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Activity object, it will not be re-added.
if ($v !== null) {
$v->addActivityHasFeature($this);
}
return $this;
}
示例5: testGetId
/**
* Tests Activity->getId()
*/
public function testGetId()
{
$this->assertEquals(1, $this->Activity->getId());
}
示例6: byActivity
/**
* Filter by an Activity.
*
* @param Activity $activity The Activity to filter by
*
* @return self The statements filter
*/
public function byActivity(Activity $activity)
{
$this->filter['activity'] = $activity->getId();
return $this;
}
示例7: testFind
function testFind()
{
//Arrange
$activity_name = "Activity One";
$activity_date = '2016-01-01';
$activity_location = "Location";
$activity_description = "Description of Activity One";
$activity_price = "Price of Activity One";
$activity_quantity = 10;
$business_id = 1;
$activity_category_id = 2;
$id = 1;
$test_activity = new Activity($activity_name, $activity_date, $activity_location, $activity_description, $activity_price, $activity_quantity, $business_id, $activity_category_id, $id);
$test_activity->save();
$activity_name2 = "Activity Two";
$activity_date2 = '2016-02-02';
$activity_location2 = "Location Two";
$activity_description2 = "Description of Activity Two";
$activity_price2 = "Price of Activity Two";
$activity_quantity2 = 20;
$business_id2 = 21;
$activity_category_id2 = 22;
$id2 = 2;
$test_activity2 = new Activity($activity_name, $activity_date, $activity_location, $activity_description, $activity_price, $activity_quantity, $business_id, $activity_category_id, $id = null);
$test_activity2->save();
//Act
$result = Activity::find($test_activity->getId());
//Assert
$this->assertEquals($test_activity, $result);
}
示例8: testGetId
function testGetId()
{
//Arrange
$activity_name = "Activity One";
$activity_date = 2016 - 01 - 01;
$activity_location = "Location";
$activity_description = "Description of Activity One";
$activity_price = "Price of Activity One";
$activity_quantity = 10;
$business_id = 1;
$activity_category_id = 2;
$id = 3;
$test_activity = new Activity($activity_name, $activity_date, $activity_location, $activity_description, $activity_price, $activity_quantity, $business_id, $activity_category_id, $id = null);
//Act
$result = $test_activity->getId();
//Assert
$this->assertEquals($id, $result);
}