コード例 #1
0
 /**
  * Declares an association between this object and a Clocking object.
  *
  * @param             Clocking $v
  * @return TransactionClocking The current object (for fluent API support)
  * @throws PropelException
  */
 public function setClocking(Clocking $v = null)
 {
     if ($v === null) {
         $this->setClockingId(NULL);
     } else {
         $this->setClockingId($v->getId());
     }
     $this->aClocking = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Clocking object, it will not be re-added.
     if ($v !== null) {
         $v->addTransactionClocking($this);
     }
     return $this;
 }
コード例 #2
0
 /**
  * Filter the query by a related Clocking object
  *
  * @param   Clocking|PropelObjectCollection $clocking The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 TransactionClockingQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByClocking($clocking, $comparison = null)
 {
     if ($clocking instanceof Clocking) {
         return $this->addUsingAlias(TransactionClockingPeer::CLOCKING_ID, $clocking->getId(), $comparison);
     } elseif ($clocking instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(TransactionClockingPeer::CLOCKING_ID, $clocking->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByClocking() only accepts arguments of type Clocking or PropelCollection');
     }
 }
コード例 #3
0
ファイル: entityarray.php プロジェクト: dapepe/tymio
 public static function fromClocking(Clocking $clocking, PropelPDO $con = null)
 {
     return array('Id' => $clocking->getId(), 'UserId' => $clocking->getUserId(), 'TypeId' => $clocking->getTypeId(), 'Creationdate' => $clocking->getCreationdate(), 'LastChanged' => $clocking->getLastChanged(), 'Start' => $clocking->getStart('U'), 'End' => $clocking->getEnd('U'), 'Breaktime' => $clocking->getBreaktime(), 'Comment' => $clocking->getComment(), 'ApprovalStatus' => $clocking->getApprovalStatus(), 'Deleted' => $clocking->getDeleted(), 'Frozen' => $clocking->getFrozen());
 }
コード例 #4
0
ファイル: BaseClockingQuery.php プロジェクト: dapepe/tymio
 /**
  * Exclude object from result
  *
  * @param   Clocking $clocking Object to remove from the list of results
  *
  * @return ClockingQuery The current query, for fluid interface
  */
 public function prune($clocking = null)
 {
     if ($clocking) {
         $this->addUsingAlias(ClockingPeer::ID, $clocking->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
コード例 #5
0
ファイル: BaseClockingPeer.php プロジェクト: dapepe/tymio
 /**
  * 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      Clocking $obj A Clocking 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
         ClockingPeer::$instances[$key] = $obj;
     }
 }
コード例 #6
0
ファイル: clocking.php プロジェクト: dapepe/tymio
 /**
  * Checks whether the clocking's start and end dates are within the time limit.
  * Throws an exception if the time limit is exceeded.
  *
  * @return void
  * @see pastGraceTimeExceeded()
  */
 private function validateTimeLimits(Account $account, User $authUser, Clocking $clocking, PropelPDO $con = null)
 {
     $type = $clocking->getClockingType($con);
     if ($type === null) {
         throw new Exception('Could not get clocking type with ID #' . $clocking->getTypeId() . ' for clocking #' . $clocking->getId() . '.');
     }
     // Check time limit in seconds
     $propertyName = KeyReplace::replace(self::PROPERTY_CLOCKING_TIME_LIMIT, array('type' => $type->getIdentifier()));
     $domain = $authUser->getDomain($con);
     $lastChanged = $clocking->getLastChanged('U');
     $end = $clocking->getEnd('U');
     // Check clocking-type-specific limit first, fall back to default
     $editTimeLimit = PropertyPeer::get($propertyName, $account, $domain, $authUser, $con);
     if ($editTimeLimit === null) {
         $editTimeLimit = PropertyPeer::get(self::PROPERTY_CLOCKING_TIME_LIMIT_DEFAULT, $account, $domain, $authUser, $con);
     }
     $errorData = array('changed' => $lastChanged, 'end' => $end, 'limit' => $editTimeLimit);
     if ($editTimeLimit !== null and !is_numeric($editTimeLimit)) {
         throw new APIException(self::ERROR_TIME_LIMIT, 'Invalid non-numeric value ' . json_encode($editTimeLimit) . ' encountered for property "' . $propertyName . '".', $errorData);
     }
     $minTimeAllowed = time() - $editTimeLimit;
     $result = ((double) $end > $minTimeAllowed and ($clocking->isNew() or (double) $lastChanged > $minTimeAllowed));
     if ($result) {
         return;
     }
     throw new APIException(self::ERROR_TIME_LIMIT, 'Clocking cannot be edited any more after ' . round($editTimeLimit / 3600.0, 2) . ' hours.', $errorData);
 }