AppserverIo\Appserver\Core\ApplicationServer::doctrine PHP Method

doctrine() public method

Executes a Doctrine command.
public doctrine ( React\Socket\ConnectionInterface $conn, array $command ) : void
$conn React\Socket\ConnectionInterface The connection resource
$command array The array with the command elements to execute
return void
    public function doctrine($conn, $command)
    {
        // switch to the new runlevel
        $result = $this->synchronized(function ($self, $cmd) {
            // wait till the previous commands has been finished
            while ($self->locked === true) {
                sleep(1);
            }
            // set connection and command name
            $self->command = DoctrineCommand::COMMAND;
            // lock process
            $self->locked = true;
            $self->params = $cmd;
            $self->result = null;
            // notify the AS to execute the command
            $self->notify();
            // wait for the result of the command
            while ($self->result == null) {
                $self->wait(10000);
            }
            // return the result
            return $self->result;
        }, $this, $command);
        // write the result to the output
        $conn->write($result);
    }