/** * Returns a new ChildAccountQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildAccountQuery */ public static function create($modelAlias = null, Criteria $criteria = null) { if ($criteria instanceof ChildAccountQuery) { return $criteria; } $query = new ChildAccountQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }
/** * Get the associated ChildAccount object * * @param ConnectionInterface $con Optional Connection object. * @return ChildAccount The associated ChildAccount object. * @throws PropelException */ public function getAccount(ConnectionInterface $con = null) { if ($this->aAccount === null && $this->id !== null) { $this->aAccount = ChildAccountQuery::create()->findPk($this->id, $con); // Because this foreign key represents a one-to-one relationship, we will create a bi-directional association. $this->aAccount->setProfile($this); } return $this->aAccount; }
/** * Removes this object from datastore and sets delete attribute. * * @param ConnectionInterface $con * @return void * @throws PropelException * @see Account::setDeleted() * @see Account::isDeleted() */ public function delete(ConnectionInterface $con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getServiceContainer()->getWriteConnection(AccountTableMap::DATABASE_NAME); } $con->transaction(function () use($con) { $deleteQuery = ChildAccountQuery::create()->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { $deleteQuery->delete($con); $this->postDelete($con); $this->setDeleted(true); } }); }