Example #1
0
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aPackage) {
         $this->aPackage->removeExtension($this);
     }
     $this->id = null;
     $this->key = null;
     $this->data = null;
     $this->package_id = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
 protected function updatePackage(Package &$model, KeekoPackageSchema $pkg)
 {
     $packageName = $pkg->getPackage()->getFullName();
     $result = PackageQuery::create()->filterByName($packageName)->count();
     $info = $this->service->getPackageManager()->getComposerPackage($packageName);
     if ($result == 0) {
         $model->setTitle($pkg->getTitle());
         $model->setDescription($info->getDescription());
         $model->setName($packageName);
         $model->setInstalledVersion($info->getPrettyVersion());
         $model->save();
     }
     $this->updateExtensions($model, $pkg);
 }
Example #3
0
 /**
  * Filter the query by a related \keeko\core\model\Package object
  *
  * @param \keeko\core\model\Package|ObjectCollection $package The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildApplicationQuery The current query, for fluid interface
  */
 public function filterByPackage($package, $comparison = null)
 {
     if ($package instanceof \keeko\core\model\Package) {
         return $this->addUsingAlias(ApplicationTableMap::COL_ID, $package->getId(), $comparison);
     } elseif ($package instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(ApplicationTableMap::COL_ID, $package->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByPackage() only accepts arguments of type \\keeko\\core\\model\\Package or Collection');
     }
 }
Example #4
0
 /**
  * Exclude object from result
  *
  * @param   ChildPackage $package Object to remove from the list of results
  *
  * @return $this|ChildPackageQuery The current query, for fluid interface
  */
 public function prune($package = null)
 {
     if ($package) {
         $this->addUsingAlias(PackageTableMap::COL_ID, $package->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Example #5
0
 /**
  * Get or Create the parent ChildPackage object of the current object
  *
  * @return    ChildPackage The parent object
  */
 public function getParentOrCreate($con = null)
 {
     if ($this->isNew()) {
         if ($this->isPrimaryKeyNull()) {
             $parent = new ChildPackage();
             $parent->setDescendantClass('keeko\\core\\model\\Application');
             return $parent;
         } else {
             $parent = \keeko\core\model\PackageQuery::create()->findPk($this->getPrimaryKey(), $con);
             if (null === $parent || null !== $parent->getDescendantClass()) {
                 $parent = new ChildPackage();
                 $parent->setPrimaryKey($this->getPrimaryKey());
                 $parent->setDescendantClass('keeko\\core\\model\\Application');
             }
             return $parent;
         }
     } else {
         return ChildPackageQuery::create()->findPk($this->getPrimaryKey(), $con);
     }
 }