public function getValues() { if (null === $this->entries) { $this->__load___(); } return $this->entries->getValues(); }
/** * @return array */ public function getAuthorizationsCodes() { $codes = $this->authorizations->getValues(); array_walk($codes, function (&$item) { $item = Authorization::PREFIX . $item->getCode(); }); return $codes; }
/** * Generates a string of currently query to use for the cache second level cache. * * @return string */ protected function getHash() { $query = $this->getSQL(); $hints = $this->getHints(); $params = array_map(function (Parameter $parameter) { // Small optimization // Does not invoke processParameterValue for scalar values if (is_scalar($value = $parameter->getValue())) { return $value; } return $this->processParameterValue($value); }, $this->parameters->getValues()); ksort($hints); return sha1($query . '-' . serialize($params) . '-' . serialize($hints)); }
/** * @param ArrayCollection|array $parameters * @throws \InvalidArgumentException * @return BufferedQueryResultIterator */ public function setParameters($parameters) { $this->assertQueryWasNotExecuted('parameters'); if ($parameters instanceof ArrayCollection) { $this->parameters = $parameters->getValues(); } elseif (is_array($parameters)) { $this->parameters = $parameters; } else { throw new \InvalidArgumentException(sprintf('$parameters is expect to be an array or instance of "%s", "%s" is given', 'Doctrine\\Common\\Collections\\ArrayCollection', is_object($parameters) ? get_class($parameters) : gettype($parameters))); } return $this; }
/** {@inheritDoc} */ public function getValues() { $this->initialize(); return $this->collection->getValues(); }
/** * Gets all values of the collection. * * @return array The values of all elements in the collection, in the order they * appear in the collection. */ public function getValues() { return $this->collection->getValues(); }
/** * Returns the attachments for this project. * * @return ProjectAttachment[] The attachments */ public function getAttachments() { return $this->attachments->getValues(); }
/** * @return ArrayCollection */ public function getRecipients() { return $this->recipients->getValues(); }
/** * Adds parameter to collection and removes all other parameters with same name. * * @param ArrayCollection $parameters * @param Parameter $newParameter */ protected function addOrReplaceParameter(ArrayCollection $parameters, Parameter $newParameter) { $removeParameters = []; /** @var Parameter $parameter */ foreach ($parameters->getValues() as $parameter) { if ($parameter->getName() === $newParameter->getName()) { $removeParameters[] = $parameter; } } foreach ($removeParameters as $removeParameter) { $parameters->removeElement($removeParameter); } $parameters->add($newParameter); }
function getValues() { return $this->fields->getValues(); }
/** * Tests IdentityWrapper->getValues() */ public function testGetValues() { $expected = array_values($this->entries); $this->assertSame($expected, $this->identityWrapper->getValues()); $this->assertSame($expected, $this->wrappedCollection->getValues()); }
/** * @param array $fields * @param array $data * @throws \HttpException */ public function checkForMandatoryFields($fields, array $data) { $errors = new ArrayCollection(); foreach ($fields as $field) { if (!array_key_exists($field, $data) || empty($data[$field])) { $errors->add($field . " is Mandatory"); } } if ($errors->count() > 0) { throw new HttpException(Codes::HTTP_BAD_REQUEST, json_encode($errors->getValues())); } }
public static function getAllVentas($ventas) { $ventasTO = new ArrayCollection(); if (count($ventas) > Generalkeys::NUMBER_ZERO) { foreach ($ventas as $venta) { $ventaTO = new VentaCompletaTO(); $ventaDetalle = $venta->getVentaDetalle()->get(0); $ventaTO->setIdVenta($venta->getId()); $ventaTO->setTipoReserva($ventaDetalle->getTipoProducto()); $ventaTO->setNombres($venta->getDatosPersonales()->getNombres()); $ventaTO->setApellidos($venta->getDatosPersonales()->getApellidos()); $ventaTO->setTelefono($venta->getDatosUbicacion()->getTelefono()); $ventaTO->setEmail($venta->getDatosUbicacion()->getEmail()); $ventaTO->setNumeroAdultos($ventaDetalle->getNumeroAdultos()); $ventaTO->setNumeroMenores($ventaDetalle->getNumeroMenores()); $ventaTO->setCostoTotal($venta->getTotal()); $ventaTO->setPagado($venta->getDatosPago()->getPagado()); $ventaTO->setNombreProducto(self::getDescripcionProducto($ventaDetalle)); $ventaTO->setFechaReserva(get_object_vars($venta->getDatosReserva()->getCheckIn())['date']); $ventaTO->setHotelPickup($venta->getDatosReserva()->getHotelPickup()); if (is_null($venta->getDatosVuelo())) { $ventaTO->setFechaLlegada(0); $ventaTO->setFechaLlegada(0); $ventaTO->setHoraLlegada(0); $ventaTO->setNumeroVuelo(0); $ventaTO->setAerolinea(0); } else { $ventaTO->setFechaLlegada($venta->getDatosVuelo()->getFechaLlegada()); $ventaTO->setHoraLlegada($venta->getDatosVuelo()->getHoraLlegada()); $ventaTO->setNumeroVuelo($venta->getDatosVuelo()->getNumeroVuelo()); $ventaTO->setAerolinea($venta->getDatosVuelo()->getAerolinea()); $ventaTO->setHotelPickup($ventaDetalle->getHotel()->getDescripcion()); } $ventaTO->setNumeroVoucher($venta->getDatosPago()->getNumeroVoucher()); $ventasTO->add($ventaTO); } } return $ventasTO->getValues(); }
public function getLettersFromContainer() { return json_encode($this->lettersContainer->getValues()); }
/** * @return array */ public function get_all() { $result = new ArrayCollection(); foreach ($this->processingFunction->findAll() as $item) { $args = $this->processingArgs->findBy(['itemId' => $item->getId()]); foreach ($args as $arg) { $result->add(['itemId' => $item->getId(), 'id' => $arg->getId(), 'function' => $item->getFunction(), 'argsKey' => $arg->getKeyName(), 'argsValue' => $arg->getValue()]); } } return $result->getValues(); }
/** * @return mixed */ public function getBudgets() { return $this->budgets->getValues(); }
/** * Get plugins recorded as "installed on the server" * * @return \Doctrine\Common\Collections\ArrayCollection */ public function getPlugins() { if ($this->plugins instanceof \Doctrine\ORM\PersistentCollection) { return $this->plugins->getValues(); } else { return $this->plugins; } }
/** * @dataProvider provideDifferentElements */ public function testGetValues($elements) { $collection = new ArrayCollection($elements); $this->assertSame(array_values($elements), $collection->getValues()); }
/** * @return UserRoleInterface[] */ public function getRoles() { return $this->userRole->getValues(); }
/** * Computes the changes that happened to a single entity. * * Modifies/populates the following properties: * * {@link _originalEntityData} * If the entity is NEW or MANAGED but not yet fully persisted (only has an id) * then it was not fetched from the database and therefore we have no original * entity data yet. All of the current entity data is stored as the original entity data. * * {@link _entityChangeSets} * The changes detected on all properties of the entity are stored there. * A change is a tuple array where the first entry is the old value and the second * entry is the new value of the property. Changesets are used by persisters * to INSERT/UPDATE the persistent entity state. * * {@link _entityUpdates} * If the entity is already fully MANAGED (has been fetched from the database before) * and any changes to its properties are detected, then a reference to the entity is stored * there to mark it for an update. * * {@link _collectionDeletions} * If a PersistentCollection has been de-referenced in a fully MANAGED entity, * then this collection is marked for deletion. * * @ignore * * @internal Don't call from the outside. * * @param ClassMetadata $class The class descriptor of the entity. * @param object $entity The entity for which to compute the changes. * * @return void */ public function computeChangeSet(ClassMetadata $class, $entity) { $oid = spl_object_hash($entity); if (isset($this->readOnlyObjects[$oid])) { return; } if (!$class->isInheritanceTypeNone()) { $class = $this->em->getClassMetadata(get_class($entity)); } $invoke = $this->listenersInvoker->getSubscribedSystems($class, Events::preFlush) & ~ListenersInvoker::INVOKE_MANAGER; if ($invoke !== ListenersInvoker::INVOKE_NONE) { $this->listenersInvoker->invoke($class, Events::preFlush, $entity, new PreFlushEventArgs($this->em), $invoke); } $actualData = array(); foreach ($class->reflFields as $name => $refProp) { $value = $refProp->getValue($entity); if ($class->isCollectionValuedAssociation($name) && $value !== null) { if ($value instanceof PersistentCollection) { if ($value->getOwner() === $entity) { continue; } $value = new ArrayCollection($value->getValues()); } // If $value is not a Collection then use an ArrayCollection. if (!$value instanceof Collection) { $value = new ArrayCollection($value); } $assoc = $class->associationMappings[$name]; // Inject PersistentCollection $value = new PersistentCollection($this->em, $this->em->getClassMetadata($assoc['targetEntity']), $value); $value->setOwner($entity, $assoc); $value->setDirty(!$value->isEmpty()); $class->reflFields[$name]->setValue($entity, $value); $actualData[$name] = $value; continue; } if ((!$class->isIdentifier($name) || !$class->isIdGeneratorIdentity()) && $name !== $class->versionField) { $actualData[$name] = $value; } } if (!isset($this->originalEntityData[$oid])) { // Entity is either NEW or MANAGED but not yet fully persisted (only has an id). // These result in an INSERT. $this->originalEntityData[$oid] = $actualData; $changeSet = array(); foreach ($actualData as $propName => $actualValue) { if (!isset($class->associationMappings[$propName])) { $changeSet[$propName] = array(null, $actualValue); continue; } $assoc = $class->associationMappings[$propName]; if ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE) { $changeSet[$propName] = array(null, $actualValue); } } $this->entityChangeSets[$oid] = $changeSet; } else { // Entity is "fully" MANAGED: it was already fully persisted before // and we have a copy of the original data $originalData = $this->originalEntityData[$oid]; $isChangeTrackingNotify = $class->isChangeTrackingNotify(); $changeSet = $isChangeTrackingNotify && isset($this->entityChangeSets[$oid]) ? $this->entityChangeSets[$oid] : array(); foreach ($actualData as $propName => $actualValue) { // skip field, its a partially omitted one! if (!(isset($originalData[$propName]) || array_key_exists($propName, $originalData))) { continue; } $orgValue = $originalData[$propName]; // skip if value haven't changed if ($orgValue === $actualValue) { continue; } // if regular field if (!isset($class->associationMappings[$propName])) { if ($isChangeTrackingNotify) { continue; } $changeSet[$propName] = array($orgValue, $actualValue); continue; } $assoc = $class->associationMappings[$propName]; // Persistent collection was exchanged with the "originally" // created one. This can only mean it was cloned and replaced // on another entity. if ($actualValue instanceof PersistentCollection) { $owner = $actualValue->getOwner(); if ($owner === null) { // cloned $actualValue->setOwner($entity, $assoc); } else { if ($owner !== $entity) { // no clone, we have to fix if (!$actualValue->isInitialized()) { $actualValue->initialize(); // we have to do this otherwise the cols share state } $newValue = clone $actualValue; $newValue->setOwner($entity, $assoc); $class->reflFields[$propName]->setValue($entity, $newValue); } } } if ($orgValue instanceof PersistentCollection) { // A PersistentCollection was de-referenced, so delete it. $coid = spl_object_hash($orgValue); if (isset($this->collectionDeletions[$coid])) { continue; } $this->collectionDeletions[$coid] = $orgValue; $changeSet[$propName] = $orgValue; // Signal changeset, to-many assocs will be ignored. continue; } if ($assoc['type'] & ClassMetadata::TO_ONE) { if ($assoc['isOwningSide']) { $changeSet[$propName] = array($orgValue, $actualValue); } if ($orgValue !== null && $assoc['orphanRemoval']) { $this->scheduleOrphanRemoval($orgValue); } } } if ($changeSet) { $this->entityChangeSets[$oid] = $changeSet; $this->originalEntityData[$oid] = $actualData; $this->entityUpdates[$oid] = $entity; } } // Look for changes in associations of the entity foreach ($class->associationMappings as $field => $assoc) { if (($val = $class->reflFields[$field]->getValue($entity)) === null) { continue; } $this->computeAssociationChanges($assoc, $val); if (!isset($this->entityChangeSets[$oid]) && $assoc['isOwningSide'] && $assoc['type'] == ClassMetadata::MANY_TO_MANY && $val instanceof PersistentCollection && $val->isDirty()) { $this->entityChangeSets[$oid] = array(); $this->originalEntityData[$oid] = $actualData; $this->entityUpdates[$oid] = $entity; } } }
public static function mangerCombinacionesPaquetes($combinaciones) { $combinacionesArray = new ArrayCollection(); $imagenes = new ArrayCollection(); if (count($combinaciones) > Generalkeys::NUMBER_ZERO) { $idHotel = $combinaciones[0]['id_hotel']; $comTmp = null; $cont = 0; foreach ($combinaciones as $combinacion) { $cont++; if ((int) $combinacion['id_hotel'] == $idHotel) { $comTmp = $combinacion; $imagenes->add($combinacion['path']); } else { $comTmp["imageneshotel"] = $imagenes->getValues(); $combinacionesArray->add($comTmp); $imagenes = new ArrayCollection(); $comTmp = $combinacion; $imagenes->add($combinacion['path']); } $idHotel = $combinacion['id_hotel']; if (count($combinaciones) == $cont) { $comTmp["imageneshotel"] = $imagenes->getValues(); $combinacionesArray->add($comTmp); } } } return $combinacionesArray->getValues(); }