Example #1
0
 /**
  * Declares an association between this object and a Chart object.
  *
  * @param             Chart $v
  * @return Chart The current object (for fluent API support)
  * @throws PropelException
  */
 public function setChartRelatedByForkedFrom(Chart $v = null)
 {
     if ($v === null) {
         $this->setForkedFrom(NULL);
     } else {
         $this->setForkedFrom($v->getId());
     }
     $this->aChartRelatedByForkedFrom = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Chart object, it will not be re-added.
     if ($v !== null) {
         $v->addChartRelatedById($this);
     }
     return $this;
 }
Example #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      Chart $obj A Chart 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
         ChartPeer::$instances[$key] = $obj;
     }
 }
Example #3
0
 /**
  * Exclude object from result
  *
  * @param   Chart $chart Object to remove from the list of results
  *
  * @return ChartQuery The current query, for fluid interface
  */
 public function prune($chart = null)
 {
     if ($chart) {
         $this->addUsingAlias(ChartPeer::ID, $chart->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Example #4
0
 /**
  * Filter the query by a related Chart object
  *
  * @param   Chart|PropelObjectCollection $chart The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 JobQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByChart($chart, $comparison = null)
 {
     if ($chart instanceof Chart) {
         return $this->addUsingAlias(JobPeer::CHART_ID, $chart->getId(), $comparison);
     } elseif ($chart instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(JobPeer::CHART_ID, $chart->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByChart() only accepts arguments of type Chart or PropelCollection');
     }
 }
Example #5
0
$t->isa_ok($sha1, 'string', '->save() creates a sha for each chart');
$g->setKilometersFrom(235);
$g->save();
$sha2 = $g->getHash();
$t->cmp_ok($sha1, '!=', $sha2, '->save() The hash field is updated each time the object is changed');
$g = new Chart();
$g->setFormat('png');
$g->setKilometersTo(12423);
$g->setUserId($ut->getUserId('ruf'));
$g->link('Vehicles', array($ut->getVehicleId('vw-touran-1-4-tsi')));
$g->link('Categories', array($ut->getIdForCategory('Fuel')));
$sha = $g->getHash();
$g2 = new Chart();
$g2->setUserId($ut->getUserId('ruf'));
$g->save();
$finalsha = $g->getHash();
$t->isnt($sha, $finalsha, 'When saving the object, ->save() checks that a unique sha is set. If not, a new one is generated.');
// ->delete()
$t->diag('->delete()');
$g = new Chart();
$g->setUserId($ut->getUserId('ruf'));
$g->save();
$id = $g->getId();
$path = $g->getChartFileSystemPath();
$fs = new sfFilesystem(new sfEventDispatcher());
$fs->touch($path);
$t->cmp_ok(file_exists($path), '===', true, 'A Chart may have an associated figure file.');
$g->delete();
$g2 = Doctrine_Core::getTable('Chart')->findOneById($id);
$t->cmp_ok($g2, '===', false, '->delete() deletes the chart from the DB');
$t->cmp_ok(file_exists($path), '===', false, '->delete() also deletes the image associated to the Chart');