LeanMapper\Row::attach PHP Method

attach() public method

Marks Row as attached
public attach ( integer $id, string $table )
$id integer
$table string
    public function attach($id, $table)
    {
        $this->result->attach($id, $table);
        $this->id = $id;
    }

Usage Example

Example #1
0
 /**
  * Attaches entity
  *
  * @param int $id
  * @throws InvalidStateException
  */
 public function attach($id)
 {
     if ($this->mapper === null) {
         throw new InvalidStateException('Missing mapper in ' . get_called_class() . '.');
     }
     $this->row->attach($id, $this->mapper->getTable(get_called_class()));
 }