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;
 }
Exemplo n.º 2
0
 /**
  * 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;
     }
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 /**
  * 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;
 }
 /**
  * Tests Activity->getId()
  */
 public function testGetId()
 {
     $this->assertEquals(1, $this->Activity->getId());
 }
Exemplo n.º 6
0
 /**
  * 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;
 }
Exemplo n.º 7
0
 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);
 }
 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);
 }