/** * Constructor. * * @param \WordPress\Model\DefinitionInterface $definition * @param \WordPress\Model\DefinitionInterface $related_definition */ public function __construct(DefinitionInterface $definition, DefinitionInterface $related_definition) { $this->definition = $definition; $this->key = $this->definition->getPrimaryKey(); $this->relatedDefinition = $related_definition; $this->foreignKey = $this->definition->getName() . '_' . $this->key; }
/** * Returns the model's primary key. * * Default = "id" * * @return string */ public function getPrimaryKey() { return $this->definition->getPrimaryKey(); }