<?php
namespace Finance\ExpBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* Document
*
* @ORM\Table(name="exp_document", indexes={@ORM\Index(name="tasks_user_id_index", columns={"initiator_id"})})
* @ORM\Entity(repositoryClass="Finance\ExpBundle\Repository\DocumentRepository")
*/
class Document
{
/**
* @var integer
*
* @ORM\Column(name="initiator_id", type="integer", nullable=false)
*/
private $initiatorId;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255, nullable=false)
*/
private $name;
/**
* @var \DateTime
*
* @ORM\Column(name="created_at", type="datetime", nullable=true)
*/
private $createdAt;
/**
* @var \DateTime
*
* @ORM\Column(name="updated_at", type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* One Customer has One Cart.
* @var DocStatus
* @ORM\OneToOne(targetEntity="DocStatus", mappedBy="document")
*/
private $docStatus;
/**
* @return DocStatus
*/
public function getDocStatus()
{
return $this->docStatus;
}
/**
* @return Status
*/
public function getStatus()
{
return $this->getDocStatus()->getStatus();
}
/**
* Set initiatorId
*
* @param integer $initiatorId
*
* @return Document
*/
public function setInitiatorId($initiatorId)
{
$this->initiatorId = $initiatorId;
return $this;
}
/**
* Get initiatorId
*
* @return integer
*/
public function getInitiatorId()
{
return $this->initiatorId;
}
/**
* Set name
*
* @param string $name
*
* @return Document
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return Document
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set updatedAt
*
* @param \DateTime $updatedAt
*
* @return Document
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
}
<?php
namespace Finance\ExpBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* DocStatus
*
* @ORM\Table(name="exp_doc_status", indexes={@ORM\Index(name="id_doc", columns={"id_doc"}), @ORM\Index(name="id_status", columns={"id_status"})})
* @ORM\Entity
*/
class DocStatus
{
/**
* @var \DateTime
*
* @ORM\Column(name="event_date", type="datetime", nullable=false)
*/
private $eventDate = 'CURRENT_TIMESTAMP';
/**
* @var integer
*
* @ORM\Column(name="event_day", type="integer", nullable=false)
*/
private $eventDay = '0';
/**
* @var integer
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="NONE")
*/
private $idDoc;
/**
* @ORM\OneToOne(targetEntity="Document", inversedBy="docStatus")
* @ORM\JoinColumn(name="id_doc", referencedColumnName="id")
*/
private $document;
/**
* @ORM\ManyToOne(targetEntity="Status", inversedBy="docStatus")
* @ORM\JoinColumn(name="id_status", referencedColumnName="id")
*/
private $status;
public function getStatus()
{
return $this->status;
}
public function getDocument()
{
return $this->document;
}
/**
* @var integer
* @ORM\Id
* @ORM\Column(name="id_status", type="integer", nullable=false)
*/
private $idStatus;
/**
* Set eventDate
*
* @param \DateTime $eventDate
*
* @return DocStatus
*/
public function setEventDate($eventDate)
{
$this->eventDate = $eventDate;
return $this;
}
/**
* Get eventDate
*
* @return \DateTime
*/
public function getEventDate()
{
return $this->eventDate;
}
/**
* Set eventDay
*
* @param integer $eventDay
*
* @return DocStatus
*/
public function setEventDay($eventDay)
{
$this->eventDay = $eventDay;
return $this;
}
/**
* Get eventDay
*
* @return int
*/
public function getEventDay()
{
return $this->eventDay;
}
/**
* Get idDoc
*
* @return \Finance\ExpBundle\Entity\Document
*/
public function getIdDoc()
{
return $this->idDoc;
}
}
<?php
namespace Finance\ExpBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Status
*
* @ORM\Table(name="exp_status")
* @ORM\Entity
*/
class Status
{
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255, nullable=false)
*/
private $name;
/**
* @var integer
*
* @ORM\Column(name="day_by_reglament", type="integer", nullable=false)
*/
private $dayByReglament = '0';
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @ORM\OneToMany(targetEntity="DocStatus", mappedBy="status")
*/
private $docStatus;
public function getDocStatus()
{
return $this->docStatus;
}
/**
* Set name
*
* @param string $name
*
* @return Status
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set dayByReglament
*
* @param integer $dayByReglament
*
* @return Status
*/
public function setDayByReglament($dayByReglament)
{
$this->dayByReglament = $dayByReglament;
return $this;
}
/**
* Get dayByReglament
*
* @return integer
*/
public function getDayByReglament()
{
return $this->dayByReglament;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
}
$em = $this->getDoctrine();
$repoDoc = $em->getRepository(Document::class);
$doc = $repoDoc->find($id);
dump($doc->getStatus()->getName());
dump($doc->getStatus()->getDayByReglament());
{{ dump(doc.status.name) }}
{{ dump(doc.status.dayByReglament) }}
var start = new Date();
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : '',
database : 'epr'
});
for (var i = 0; i < 1000; i++) {
connection.query(
'SELECT * FROM dreg_document',
function(error, result, fields){
var str = '';
result.forEach(function(row){
str += ' ' + row.id + ' ';
});
console.log(str);
}
);
}
connection.end();
var end = new Date();
console.log('node.js %d мс', (end.getTime()-start.getTime()) / 1000);
client.send('qwerty');
client.send('qwerty');
console.log(str);
// начало выполнения скрипта
var start = new Date();
// счетчик обращений к БД
var ConnCountGlobal = 0;
// Число обращений к БД
var iLength = 100;
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : '',
database : 'epr'
});
for (var i = 0; i < iLength; i++) {
connection.query(
'SELECT * FROM dreg_document',
function(error, result, fields){
// для последнего запроса вычисляем таймер
if (ConnCountGlobal == iLength-1){
var dateObj = new Date();
var currTime = dateObj.getTime();
console.log(' node.js - %d мс', (currTime-start.getTime()) / 1000);
}
ConnCountGlobal++;
}
);
}
connection.end();
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<username>marchenko_am@domain.ru</username>
<password>1</password>
<host>192.168.0.31</host>
<port>8080</port>
<nonProxyHosts>local.net|domain.ru</nonProxyHosts>
</proxy>
</proxies>