Esempio n. 1
0
 /**
  * Return the primary key of the Link Model if it has been persisted.
  *
  * @return array|null Primary key or Null if the Linked Model has not been persisted.
  */
 public function getId()
 {
     // The given id consists of the ids of the referenced linked models,
     // but there is no evidence that the LinkModel itself has been persisted yet.
     // We so have to validate, if the LinkModel is persistent or still transient.
     if (true === $this->isNewRecord()) {
         // its a new record, so return null
         return null;
     }
     // its not a new record, so we can hand over to the parent method
     return parent::getId();
 }