示例#1
0
 /**
  * Exclude object from result
  *
  * @param   ChildFile $file Object to remove from the list of results
  *
  * @return $this|ChildFileQuery The current query, for fluid interface
  */
 public function prune($file = null)
 {
     if ($file) {
         $this->addUsingAlias(FileTableMap::COL_ID, $file->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
示例#2
0
 protected function fileValidateOne()
 {
     setContentType("json");
     $file = new File();
     $given = array_keys($_POST);
     $response["error"] = null;
     if (count($given) == 1) {
         if ($given[0] == "description") {
             $file->setDescription($_POST["description"]);
         }
         if (!$file->validate()) {
             foreach ($file->getValidationFailures() as $failure) {
                 if ($given[0] == $failure->getPropertyPath()) {
                     $response["error"] = array("name" => $failure->getPropertyPath(), "message" => $failure->getMessage());
                 }
             }
         }
         $this->viewString(json_encode($response));
     }
 }
示例#3
0
文件: Note.php 项目: OneTimeCZ/Tasker
 /**
  * @param ChildFile $file The ChildFile object to add.
  */
 protected function doAddFile(ChildFile $file)
 {
     $this->collFiles[] = $file;
     $file->setNote($this);
 }
示例#4
0
 /**
  * Filter the query by a related \Models\File object
  *
  * @param \Models\File|ObjectCollection $file the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildPackQuery The current query, for fluid interface
  */
 public function filterByFile($file, $comparison = null)
 {
     if ($file instanceof \Models\File) {
         return $this->addUsingAlias(PackTableMap::COL_ID, $file->getPackId(), $comparison);
     } elseif ($file instanceof ObjectCollection) {
         return $this->useFileQuery()->filterByPrimaryKeys($file->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByFile() only accepts arguments of type \\Models\\File or Collection');
     }
 }