LeanMapper\Entity::attach PHP Method

attach() public method

Attaches entity
public attach ( integer $id )
$id integer
    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()));
    }

Usage Example

Example #1
0
 /**
  * @param \LeanMapper\Entity $entity
  * @param $id
  * @return void
  */
 public function makeAlive(\LeanMapper\Entity $entity, $id)
 {
     \Nette\Utils\Validators::assert($id, 'numericint:1..');
     $entity->makeAlive($this->entityFactory, $this->connection, $this->mapper);
     $entity->attach($id);
 }
All Usage Examples Of LeanMapper\Entity::attach