/**
  * @param integer $limit
  * @return void
  */
 public function listCommand($limit = 50)
 {
     $deployments = $this->deploymentRepository->findAllWithLimit($limit);
     foreach ($deployments as $deployment) {
         $this->outputLine($this->persistenceManager->getIdentifierByObject($deployment) . ' ' . $deployment->getDate()->format('d.m.Y H:i') . ' ' . $deployment->getRepositoryIdentifier() . ' ' . $deployment->getStatus());
     }
 }
 /**
  * @test
  */
 public function getIdentifierByObjectUsesUnitOfWorkIdentityWithEmptyFlowPersistenceIdentifier()
 {
     $entity = (object) array('Persistence_Object_Identifier' => null);
     $this->mockEntityManager->expects($this->any())->method('contains')->with($entity)->will($this->returnValue(true));
     $this->mockUnitOfWork->expects($this->any())->method('getEntityIdentifier')->with($entity)->will($this->returnValue(array('SomeIdentifier')));
     $this->assertEquals('SomeIdentifier', $this->persistenceManager->getIdentifierByObject($entity));
 }
 /**
  * @param DoctrineSqlFilter $sqlFilter
  * @param QuoteStrategy $quoteStrategy
  * @param ClassMetadata $targetEntity
  * @param string $targetTableAlias
  * @param string $targetEntityPropertyName
  * @return string
  * @throws InvalidQueryRewritingConstraintException
  * @throws \Exception
  */
 protected function getSqlForManyToOneAndOneToOneRelationsWithPropertyPath(DoctrineSqlFilter $sqlFilter, QuoteStrategy $quoteStrategy, ClassMetadata $targetEntity, $targetTableAlias, $targetEntityPropertyName)
 {
     $subselectQuery = $this->getSubselectQuery($targetEntity, $targetEntityPropertyName);
     $associationMapping = $targetEntity->getAssociationMapping($targetEntityPropertyName);
     $subselectConstraintQueries = array();
     foreach ($associationMapping['joinColumns'] as $joinColumn) {
         $rootAliases = $subselectQuery->getQueryBuilder()->getRootAliases();
         $subselectQuery->getQueryBuilder()->select($rootAliases[0] . '.' . $targetEntity->getFieldForColumn($joinColumn['referencedColumnName']));
         $subselectSql = $subselectQuery->getSql();
         foreach ($subselectQuery->getParameters() as $parameter) {
             $parameterValue = $parameter->getValue();
             if (is_object($parameterValue)) {
                 $parameterValue = $this->persistenceManager->getIdentifierByObject($parameter->getValue());
             }
             $subselectSql = preg_replace('/\\?/', $this->entityManager->getConnection()->quote($parameterValue, $parameter->getType()), $subselectSql, 1);
         }
         $quotedColumnName = $quoteStrategy->getJoinColumnName($joinColumn, $targetEntity, $this->entityManager->getConnection()->getDatabasePlatform());
         $subselectIdentifier = 'subselect' . md5($subselectSql);
         $subselectConstraintQueries[] = $targetTableAlias . '.' . $quotedColumnName . ' IN (SELECT ' . $subselectIdentifier . '.' . $joinColumn['referencedColumnName'] . '0 FROM (' . $subselectSql . ') AS ' . $subselectIdentifier . ' ) ';
     }
     return ' (' . implode(' ) AND ( ', $subselectConstraintQueries) . ') ';
 }