public function load($id, $idDetail = null) { if (is_null($this->primaryKeyName)) { throw org_glizy_dataAccessDoctrine_ActiveRecordException::primaryKeyNotDefined($this->tableName); } $qb = $this->createQueryBuilder()->select('*')->where($this->primaryKeyName . ' = :id')->setParameter(':id', $id); if ($idDetail != null) { $qb->andWhere($this->detailPrimaryKeyName . ' = :idDetail')->setParameter(':idDetail', $idDetail); } $this->addLanguageFilter($qb); $this->addSiteFilter($qb); $r = $qb->execute()->fetch(); if ($r) { $this->loadFromArray($r); $this->buildAllRelations(); return true; } else { $this->emptyRecord(); return false; } }
public function getId() { if (is_null($this->primaryKeyName)) { throw org_glizy_dataAccessDoctrine_ActiveRecordException::primaryKeyNotDefined($this->tableName); } $primarykey = $this->primaryKeyName; return $this->{$primarykey}; }