コード例 #1
0
 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;
     }
 }
コード例 #2
0
ファイル: ActiveRecord.php プロジェクト: GruppoMeta/Movio
 public function getId()
 {
     if (is_null($this->primaryKeyName)) {
         throw org_glizy_dataAccessDoctrine_ActiveRecordException::primaryKeyNotDefined($this->tableName);
     }
     $primarykey = $this->primaryKeyName;
     return $this->{$primarykey};
 }