protected function association(ProxyQueryInterface $queryBuilder, $data) { $types = array(ClassMetadataInfo::ONE_TO_ONE, ClassMetadataInfo::ONE_TO_MANY, ClassMetadataInfo::MANY_TO_MANY, ClassMetadataInfo::MANY_TO_ONE); if (!in_array($this->getOption('mapping_type'), $types)) { throw new \RunTimeException('Invalid mapping type'); } if (!$this->getOption('field_name')) { throw new \RunTimeException('please provide a field_name options'); } if (!$this->getOption('callback')) { $alias = 's_' . $this->getName(); $queryBuilder->leftJoin(sprintf('%s.%s', $queryBuilder->getRootAlias(), $this->getFieldName()), $alias); return array($alias, 'id'); } else { return array($this->getOption('alias', $queryBuilder->getRootAlias()), false); } }
protected function association(ProxyQueryInterface $queryBuilder, $data) { $types = array(ClassMetadataInfo::ONE_TO_ONE, ClassMetadataInfo::ONE_TO_MANY, ClassMetadataInfo::MANY_TO_MANY, ClassMetadataInfo::MANY_TO_ONE); if (!in_array($this->getOption('mapping_type'), $types)) { throw new \RunTimeException('Invalid mapping type'); } if (!$this->getOption('field_name')) { throw new \RunTimeException('please provide a field_name options'); } return array($this->getOption('alias', $queryBuilder->getRootAlias()), false); }
/** * {@inheritdoc} */ public function batchDelete($class, ProxyQueryInterface $queryProxy) { $queryProxy->select('DISTINCT ' . $queryProxy->getRootAlias()); try { $entityManager = $this->getEntityManager($class); $i = 0; foreach ($queryProxy->getQuery()->iterate() as $pos => $object) { $entityManager->remove($object[0]); if (++$i % 20 == 0) { $entityManager->flush(); $entityManager->clear(); } } $entityManager->flush(); $entityManager->clear(); } catch (\PDOException $e) { throw new ModelManagerException('', 0, $e); } catch (DBALException $e) { throw new ModelManagerException('', 0, $e); } }
/** * {@inheritdoc} */ protected function association(ProxyQueryInterface $queryBuilder, $data) { return array($this->getOption('alias', $queryBuilder->getRootAlias()), false); }