LeanMapper\Row::setConnection PHP Метод

setConnection() публичный Метод

public setConnection ( Connection $connection )
$connection Connection
    public function setConnection(Connection $connection)
    {
        $this->result->setConnection($connection);
    }

Usage Example

Пример #1
0
 /**
  * Provides dependencies
  *
  * @param IEntityFactory|null $entityFactory
  * @param Connection|null $connection
  * @param IMapper|null $mapper
  * @throws InvalidArgumentException
  * @throws InvalidStateException
  */
 public function makeAlive(IEntityFactory $entityFactory = null, Connection $connection = null, IMapper $mapper = null)
 {
     $entityFactory === null or $this->setEntityFactory($entityFactory);
     $mapper === null or $this->useMapper($mapper);
     $connection === null or $this->row->setConnection($connection);
     if ($this->entityFactory === null) {
         throw new InvalidStateException('Missing entity factory in entity ' . get_called_class() . '.');
     }
     if ($this->mapper === null) {
         throw new InvalidStateException('Missing mapper in entity ' . get_called_class() . '.');
     }
     if (!$this->row->hasConnection()) {
         throw new InvalidStateException('Missing connection in Result in entity ' . get_called_class() . '.');
     }
 }