_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q14500
MediaRepository.applyFilterToMediaCollection
train
protected function applyFilterToMediaCollection(Collection $media, $filter): Collection { if (is_array($filter)) { $filter = $this->getDefaultFilterFunction($filter); } return $media->filter($filter); }
php
{ "resource": "" }
q14501
MediaRepository.getDefaultFilterFunction
train
protected function getDefaultFilterFunction(array $filters): Closure { return function (Media $media) use ($filters) { foreach ($filters as $property => $value) { if (! Arr::has($media->custom_properties, $property)) { return false; } ...
php
{ "resource": "" }
q14502
Conversion.setManipulations
train
public function setManipulations($manipulations) : self { if ($manipulations instanceof Manipulations) { $this->manipulations = $this->manipulations->mergeManipulations($manipulations); } if (is_callable($manipulations)) { $manipulations($this->manipulations); ...
php
{ "resource": "" }
q14503
Conversion.addAsFirstManipulations
train
public function addAsFirstManipulations(Manipulations $manipulations) : self { $manipulationSequence = $manipulations->getManipulationSequence()->toArray(); $this->manipulations ->getManipulationSequence() ->mergeArray($manipulationSequence); return $this; }
php
{ "resource": "" }
q14504
FileManipulator.createDerivedFiles
train
public function createDerivedFiles(Media $media, array $only = [], $onlyIfMissing = false) { $profileCollection = ConversionCollection::createForMedia($media); if (! empty($only)) { $profileCollection = $profileCollection->filter(function ($collection) use ($only) { retu...
php
{ "resource": "" }
q14505
FileManipulator.performConversions
train
public function performConversions(ConversionCollection $conversions, Media $media, $onlyIfMissing = false) { if ($conversions->isEmpty()) { return; } $imageGenerator = $this->determineImageGenerator($media); if (! $imageGenerator) { return; } ...
php
{ "resource": "" }
q14506
LocalUrlGenerator.getResponsiveImagesDirectoryUrl
train
public function getResponsiveImagesDirectoryUrl(): string { return url($this->getBaseMediaDirectoryUrl().'/'.$this->pathGenerator->getPathForResponsiveImages($this->media)).'/'; }
php
{ "resource": "" }
q14507
ConversionCollection.getByName
train
public function getByName(string $name): Conversion { $conversion = $this->first(function (Conversion $conversion) use ($name) { return $conversion->getName() === $name; }); if (! $conversion) { throw InvalidConversion::unknownName($name); } return $...
php
{ "resource": "" }
q14508
ConversionCollection.addConversionsFromRelatedModel
train
protected function addConversionsFromRelatedModel(Media $media) { $modelName = Arr::get(Relation::morphMap(), $media->model_type, $media->model_type); /** @var \Spatie\MediaLibrary\HasMedia\HasMedia $model */ $model = new $modelName(); /* * In some cases the user might wan...
php
{ "resource": "" }
q14509
ConversionCollection.addManipulationsFromDb
train
protected function addManipulationsFromDb(Media $media) { collect($media->manipulations)->each(function ($manipulations, $conversionName) { $this->addManipulationToConversion(new Manipulations([$manipulations]), $conversionName); }); }
php
{ "resource": "" }
q14510
S3UrlGenerator.getTemporaryUrl
train
public function getTemporaryUrl(DateTimeInterface $expiration, array $options = []): string { return $this ->filesystemManager ->disk($this->media->disk) ->temporaryUrl($this->getPath(), $expiration, $options); }
php
{ "resource": "" }
q14511
HasMediaTrait.addMediaFromUrl
train
public function addMediaFromUrl(string $url, ...$allowedMimeTypes) { if (! $stream = @fopen($url, 'r')) { throw UnreachableUrl::create($url); } $temporaryFile = tempnam(sys_get_temp_dir(), 'media-library'); file_put_contents($temporaryFile, $stream); $this->guar...
php
{ "resource": "" }
q14512
HasMediaTrait.addMediaFromBase64
train
public function addMediaFromBase64(string $base64data, ...$allowedMimeTypes): FileAdder { // strip out data uri scheme information (see RFC 2397) if (strpos($base64data, ';base64') !== false) { [$_, $base64data] = explode(';', $base64data); [$_, $base64data] = explode(',', $b...
php
{ "resource": "" }
q14513
HasMediaTrait.updateMedia
train
public function updateMedia(array $newMediaArray, string $collectionName = 'default'): Collection { $this->removeMediaItemsNotPresentInArray($newMediaArray, $collectionName); return collect($newMediaArray) ->map(function (array $newMediaItem) use ($collectionName) { stat...
php
{ "resource": "" }
q14514
HasMediaTrait.clearMediaCollection
train
public function clearMediaCollection(string $collectionName = 'default'): self { $this->getMedia($collectionName) ->each->delete(); event(new CollectionHasBeenCleared($this, $collectionName)); if ($this->mediaIsPreloaded()) { unset($this->media); } ...
php
{ "resource": "" }
q14515
HasMediaTrait.clearMediaCollectionExcept
train
public function clearMediaCollectionExcept(string $collectionName = 'default', $excludedMedia = []) { if ($excludedMedia instanceof Media) { $excludedMedia = collect()->push($excludedMedia); } $excludedMedia = collect($excludedMedia); if ($excludedMedia->isEmpty()) { ...
php
{ "resource": "" }
q14516
HasMediaTrait.deleteMedia
train
public function deleteMedia($mediaId) { if ($mediaId instanceof Media) { $mediaId = $mediaId->id; } $media = $this->media->find($mediaId); if (! $media) { throw MediaCannotBeDeleted::doesNotBelongToModel($mediaId, $this); } $media->delete();...
php
{ "resource": "" }
q14517
HasMediaTrait.loadMedia
train
public function loadMedia(string $collectionName) { $collection = $this->exists ? $this->media : collect($this->unAttachedMediaLibraryItems)->pluck('media'); return $collection ->filter(function (Media $mediaItem) use ($collectionName) { if ($coll...
php
{ "resource": "" }
q14518
ParamHelpers.cleanParams
train
protected function cleanParams(array $params) { $values = []; foreach ($params as $name => $details) { $this->cleanValueFrom($name, $details['value'], $values); } return $values; }
php
{ "resource": "" }
q14519
ParamHelpers.cleanValueFrom
train
protected function cleanValueFrom($name, $value, array &$values = []) { if (str_contains($name, '[')) { $name = str_replace(['][', '[', ']', '..'], ['.', '.', '', '.*.'], $name); } array_set($values, str_replace('.*', '.0', $name), $value); }
php
{ "resource": "" }
q14520
ResponseTagStrategy.getDocBlockResponses
train
protected function getDocBlockResponses(array $tags) { $responseTags = array_values( array_filter($tags, function ($tag) { return $tag instanceof Tag && strtolower($tag->getName()) === 'response'; }) ); if (empty($responseTags)) { return; ...
php
{ "resource": "" }
q14521
ResponseFileStrategy.getFileResponses
train
protected function getFileResponses(array $tags) { // avoid "holes" in the keys of the filtered array, by using array_values on the filtered array $responseFileTags = array_values( array_filter($tags, function ($tag) { return $tag instanceof Tag && strtolower($tag->getNam...
php
{ "resource": "" }
q14522
Generator.castToType
train
private function castToType(string $value, string $type) { $casts = [ 'integer' => 'intval', 'number' => 'floatval', 'float' => 'floatval', 'boolean' => 'boolval', ]; // First, we handle booleans. We can't use a regular cast, //because...
php
{ "resource": "" }
q14523
TransformerTagsStrategy.getTransformerResponse
train
protected function getTransformerResponse(array $tags) { try { if (empty($transformerTag = $this->getTransformerTag($tags))) { return; } $transformer = $this->getTransformerClass($transformerTag); $model = $this->getClassToBeTransformed($tags,...
php
{ "resource": "" }
q14524
Lfm.currentLfmType
train
public function currentLfmType() { $lfm_type = 'file'; $request_type = lcfirst(str_singular($this->input('type') ?: '')); $available_types = array_keys($this->config->get('lfm.folder_categories') ?: []); if (in_array($request_type, $available_types)) { $lfm_type = $requ...
php
{ "resource": "" }
q14525
Lfm.translateFromUtf8
train
public function translateFromUtf8($input) { if ($this->isRunningOnWindows()) { $input = iconv('UTF-8', mb_detect_encoding($input), $input); } return $input; }
php
{ "resource": "" }
q14526
Lfm.routes
train
public static function routes() { $middleware = [ CreateDefaultFolder::class, MultiUser::class ]; $as = 'unisharp.lfm.'; $namespace = '\\UniSharp\\LaravelFilemanager\\Controllers\\'; Route::group(compact('middleware', 'as', 'namespace'), function () { // display main la...
php
{ "resource": "" }
q14527
ItemsController.getItems
train
public function getItems() { return [ 'items' => array_map(function ($item) { return $item->fill()->attributes; }, array_merge($this->lfm->folders(), $this->lfm->files())), 'display' => $this->helper->getDisplayMode(), 'working_dir' => $this->l...
php
{ "resource": "" }
q14528
FolderController.getAddfolder
train
public function getAddfolder() { $folder_name = $this->helper->input('name'); try { if (empty($folder_name)) { return $this->helper->error('folder-name'); } elseif ($this->lfm->setName($folder_name)->exists()) { return $this->helper->error('fo...
php
{ "resource": "" }
q14529
DeleteController.getDelete
train
public function getDelete() { $item_names = request('items'); $errors = []; foreach ($item_names as $name_to_delete) { $file_to_delete = $this->lfm->pretty($name_to_delete); $file_path = $file_to_delete->path(); event(new ImageIsDeleting($file_path)); ...
php
{ "resource": "" }
q14530
LfmPath.createFolder
train
public function createFolder() { if ($this->storage->exists($this)) { return false; } $this->storage->makeDirectory(0777, true, true); }
php
{ "resource": "" }
q14531
LfmPath.sortByColumn
train
public function sortByColumn($arr_items) { $sort_by = $this->helper->input('sort_type'); if (in_array($sort_by, ['name', 'time'])) { $key_to_sort = $sort_by; } else { $key_to_sort = 'name'; } uasort($arr_items, function ($a, $b) use ($key_to_sort) { ...
php
{ "resource": "" }
q14532
LfmController.getErrors
train
public function getErrors() { $arr_errors = []; if (! extension_loaded('gd') && ! extension_loaded('imagick')) { array_push($arr_errors, trans('laravel-filemanager::lfm.message-extension_not_found')); } if (! extension_loaded('exif')) { array_push($arr_error...
php
{ "resource": "" }
q14533
LfmController.applyIniOverrides
train
public function applyIniOverrides() { $overrides = config('lfm.php_ini_overrides'); if ($overrides && is_array($overrides) && count($overrides) === 0) { return; } foreach ($overrides as $key => $value) { if ($value && $value != 'false') { ini_...
php
{ "resource": "" }
q14534
ResizeController.getResize
train
public function getResize() { $ratio = 1.0; $image = request('img'); $original_image = Image::make($this->lfm->setName($image)->path('absolute')); $original_width = $original_image->width(); $original_height = $original_image->height(); $scaled = false; // ...
php
{ "resource": "" }
q14535
FlashPolicy.addAllowedAccess
train
public function addAllowedAccess($domain, $ports = '*', $secure = false) { if (!$this->validateDomain($domain)) { throw new \UnexpectedValueException('Invalid domain'); } if (!$this->validatePorts($ports)) { throw new \UnexpectedValueException('Invalid Port'); } ...
php
{ "resource": "" }
q14536
FlashPolicy.setSiteControl
train
public function setSiteControl($permittedCrossDomainPolicies = 'all') { if (!$this->validateSiteControl($permittedCrossDomainPolicies)) { throw new \UnexpectedValueException('Invalid site control set'); } $this->_siteControl = $permittedCrossDomainPolicies; $this->_cacheVali...
php
{ "resource": "" }
q14537
FlashPolicy.renderPolicy
train
public function renderPolicy() { $policy = new \SimpleXMLElement($this->_policy); $siteControl = $policy->addChild('site-control'); if ($this->_siteControl == '') { $this->setSiteControl(); } $siteControl->addAttribute('permitted-cross-domain-policies', $this->_sit...
php
{ "resource": "" }
q14538
Topic.broadcast
train
public function broadcast($msg, array $exclude = array(), array $eligible = array()) { $useEligible = (bool)count($eligible); foreach ($this->subscribers as $client) { if (in_array($client->WAMP->sessionId, $exclude)) { continue; } if ($useEligible &&...
php
{ "resource": "" }
q14539
IoServer.handleConnect
train
public function handleConnect($conn) { $conn->decor = new IoConnection($conn); $conn->decor->resourceId = (int)$conn->stream; $uri = $conn->getRemoteAddress(); $conn->decor->remoteAddress = trim( parse_url((strpos($uri, '://') === false ? 'tcp://' : '') . $uri, PHP_URL_HOST)...
php
{ "resource": "" }
q14540
IoServer.handleData
train
public function handleData($data, $conn) { try { $this->app->onMessage($conn->decor, $data); } catch (\Exception $e) { $this->handleError($e, $conn); } }
php
{ "resource": "" }
q14541
IoServer.handleEnd
train
public function handleEnd($conn) { try { $this->app->onClose($conn->decor); } catch (\Exception $e) { $this->handleError($e, $conn); } unset($conn->decor); }
php
{ "resource": "" }
q14542
IoServer.handleError
train
public function handleError(\Exception $e, $conn) { $this->app->onError($conn->decor, $e); }
php
{ "resource": "" }
q14543
CloseResponseTrait.close
train
private function close(ConnectionInterface $conn, $code = 400, array $additional_headers = []) { $response = new Response($code, array_merge([ 'X-Powered-By' => \Ratchet\VERSION ], $additional_headers)); $conn->send(gPsr\str($response)); $conn->close(); }
php
{ "resource": "" }
q14544
SessionProvider.parseCookie
train
private function parseCookie($cookie, $host = null, $path = null, $decode = false) { // Explode the cookie string using a series of semicolons $pieces = array_filter(array_map('trim', explode(';', $cookie))); // The name of the cookie (first kvp) must include an equal sign. if (empty($p...
php
{ "resource": "" }
q14545
IpBlackList.unblockAddress
train
public function unblockAddress($ip) { if (isset($this->_blacklist[$this->filterAddress($ip)])) { unset($this->_blacklist[$this->filterAddress($ip)]); } return $this; }
php
{ "resource": "" }
q14546
WampConnection.callResult
train
public function callResult($id, $data = array()) { return $this->send(json_encode(array(WAMP::MSG_CALL_RESULT, $id, $data))); }
php
{ "resource": "" }
q14547
WampConnection.callError
train
public function callError($id, $errorUri, $desc = '', $details = null) { if ($errorUri instanceof Topic) { $errorUri = (string)$errorUri; } $data = array(WAMP::MSG_CALL_ERROR, $id, $errorUri, $desc); if (null !== $details) { $data[] = $details; } ...
php
{ "resource": "" }
q14548
WampConnection.getUri
train
public function getUri($uri) { $curieSeperator = ':'; if (preg_match('/http(s*)\:\/\//', $uri) == false) { if (strpos($uri, $curieSeperator) !== false) { list($prefix, $action) = explode($curieSeperator, $uri); if(isset($this->WAMP->prefixes[...
php
{ "resource": "" }
q14549
Parameter.setValue
train
public function setValue($value, $type = null) { $this->value = $value; $this->type = $type ?: ParameterTypeInferer::inferType($value); }
php
{ "resource": "" }
q14550
FileDriver.getElement
train
public function getElement($className) { if ($this->classCache === null) { $this->initialize(); } if (isset($this->classCache[$className])) { return $this->classCache[$className]; } $result = $this->loadMappingFile($this->locator->findMappingFile($cl...
php
{ "resource": "" }
q14551
FileDriver.initialize
train
protected function initialize() { $this->classCache = []; if ($this->globalBasename !== null) { foreach ($this->locator->getPaths() as $path) { $file = $path . '/' . $this->globalBasename . $this->locator->getFileExtension(); if (is_file($file)) { ...
php
{ "resource": "" }
q14552
QueryBuilder.findRootAlias
train
private function findRootAlias($alias, $parentAlias) { $rootAlias = null; if (in_array($parentAlias, $this->getRootAliases(), true)) { $rootAlias = $parentAlias; } elseif (isset($this->joinRootAliases[$parentAlias])) { $rootAlias = $this->joinRootAliases[$parentAlias...
php
{ "resource": "" }
q14553
QueryBuilder.getRootAliases
train
public function getRootAliases() { $aliases = []; foreach ($this->dqlParts['from'] as &$fromClause) { if (is_string($fromClause)) { $spacePos = strrpos($fromClause, ' '); $from = substr($fromClause, 0, $spacePos); $alias = substr($f...
php
{ "resource": "" }
q14554
QueryBuilder.getRootEntities
train
public function getRootEntities() { $entities = []; foreach ($this->dqlParts['from'] as &$fromClause) { if (is_string($fromClause)) { $spacePos = strrpos($fromClause, ' '); $from = substr($fromClause, 0, $spacePos); $alias = substr(...
php
{ "resource": "" }
q14555
QueryBuilder.update
train
public function update($update = null, $alias = null) { $this->type = self::UPDATE; if (! $update) { return $this; } return $this->add('from', new Expr\From($update, $alias)); }
php
{ "resource": "" }
q14556
QueryBuilder.from
train
public function from($from, $alias, $indexBy = null) { return $this->add('from', new Expr\From($from, $alias, $indexBy), true); }
php
{ "resource": "" }
q14557
QueryBuilder.set
train
public function set($key, $value) { return $this->add('set', new Expr\Comparison($key, Expr\Comparison::EQ, $value), true); }
php
{ "resource": "" }
q14558
QueryBuilder.addCriteria
train
public function addCriteria(Criteria $criteria) { $allAliases = $this->getAllAliases(); if (! isset($allAliases[0])) { throw new Query\QueryException('No aliases are set before invoking addCriteria().'); } $visitor = new QueryExpressionVisitor($this->getAllAliase...
php
{ "resource": "" }
q14559
SchemaTool.createSchema
train
public function createSchema(array $classes) { $createSchemaSql = $this->getCreateSchemaSql($classes); $conn = $this->em->getConnection(); foreach ($createSchemaSql as $sql) { try { $conn->executeQuery($sql); } catch (Throwable $e) { ...
php
{ "resource": "" }
q14560
SchemaTool.getCreateSchemaSql
train
public function getCreateSchemaSql(array $classes) { $schema = $this->getSchemaFromMetadata($classes); return $schema->toSql($this->platform); }
php
{ "resource": "" }
q14561
SchemaTool.dropSchema
train
public function dropSchema(array $classes) { $dropSchemaSql = $this->getDropSchemaSQL($classes); $conn = $this->em->getConnection(); foreach ($dropSchemaSql as $sql) { try { $conn->executeQuery($sql); } catch (Throwable $e) { ...
php
{ "resource": "" }
q14562
SchemaTool.dropDatabase
train
public function dropDatabase() { $dropSchemaSql = $this->getDropDatabaseSQL(); $conn = $this->em->getConnection(); foreach ($dropSchemaSql as $sql) { $conn->executeQuery($sql); } }
php
{ "resource": "" }
q14563
SchemaTool.getDropDatabaseSQL
train
public function getDropDatabaseSQL() { $sm = $this->em->getConnection()->getSchemaManager(); $schema = $sm->createSchema(); $visitor = new DropSchemaSqlCollector($this->platform); $schema->visit($visitor); return $visitor->getQueries(); }
php
{ "resource": "" }
q14564
SchemaTool.getDropSchemaSQL
train
public function getDropSchemaSQL(array $classes) { $visitor = new DropSchemaSqlCollector($this->platform); $schema = $this->getSchemaFromMetadata($classes); $sm = $this->em->getConnection()->getSchemaManager(); $fullSchema = $sm->createSchema(); foreach ($fullSchem...
php
{ "resource": "" }
q14565
SchemaTool.updateSchema
train
public function updateSchema(array $classes, $saveMode = false) { $updateSchemaSql = $this->getUpdateSchemaSql($classes, $saveMode); $conn = $this->em->getConnection(); foreach ($updateSchemaSql as $sql) { $conn->executeQuery($sql); } }
php
{ "resource": "" }
q14566
SchemaTool.getUpdateSchemaSql
train
public function getUpdateSchemaSql(array $classes, $saveMode = false) { $sm = $this->em->getConnection()->getSchemaManager(); $fromSchema = $sm->createSchema(); $toSchema = $this->getSchemaFromMetadata($classes); $comparator = new Comparator(); $schemaDiff = $comparator->...
php
{ "resource": "" }
q14567
AbstractQuery.setParameters
train
public function setParameters($parameters) { // BC compatibility with 2.3- if (is_array($parameters)) { $parameterCollection = new ArrayCollection(); foreach ($parameters as $key => $value) { $parameterCollection->add(new Parameter($key, $value)); ...
php
{ "resource": "" }
q14568
DefaultRepositoryFactory.createRepository
train
private function createRepository(EntityManagerInterface $entityManager, $entityName) { /** @var ClassMetadata $metadata */ $metadata = $entityManager->getClassMetadata($entityName); $repositoryClassName = $metadata->getCustomRepositoryClassName() ?: $entityManager->ge...
php
{ "resource": "" }
q14569
CommitOrderCalculator.sort
train
public function sort() { foreach ($this->nodeList as $vertex) { if ($vertex->state !== self::NOT_VISITED) { continue; } $this->visit($vertex); } $sortedList = $this->sortedNodeList; $this->nodeList = []; $this->sort...
php
{ "resource": "" }
q14570
ClassMetadata.validateLifecycleCallbacks
train
public function validateLifecycleCallbacks(ReflectionService $reflectionService) : void { foreach ($this->lifecycleCallbacks as $callbacks) { /** @var array $callbacks */ foreach ($callbacks as $callbackFuncName) { if (! $reflectionService->hasPublicMethod($this->clas...
php
{ "resource": "" }
q14571
ClassMetadata.validateAndCompleteToOneAssociationMetadata
train
protected function validateAndCompleteToOneAssociationMetadata(ToOneAssociationMetadata $property) { $fieldName = $property->getName(); if ($property->isOwningSide()) { if (empty($property->getJoinColumns())) { // Apply default join column $property->addJ...
php
{ "resource": "" }
q14572
ClassMetadata.validateAndCompleteManyToOneMapping
train
protected function validateAndCompleteManyToOneMapping(ManyToOneAssociationMetadata $property) { // A many-to-one mapping is essentially a one-one backreference if ($property->isOrphanRemoval()) { throw MappingException::illegalOrphanRemoval($this->className, $property->getName()); ...
php
{ "resource": "" }
q14573
ClassMetadata.getSingleIdentifierFieldName
train
public function getSingleIdentifierFieldName() { if ($this->isIdentifierComposite()) { throw MappingException::singleIdNotAllowedOnCompositePrimaryKey($this->className); } if (! isset($this->identifier[0])) { throw MappingException::noIdDefined($this->className); ...
php
{ "resource": "" }
q14574
ClassMetadata.getIdentifierColumns
train
public function getIdentifierColumns(EntityManagerInterface $em) : array { $columns = []; foreach ($this->identifier as $idProperty) { $property = $this->getProperty($idProperty); if ($property instanceof FieldMetadata) { $columns[$property->getColumnName()]...
php
{ "resource": "" }
q14575
ClassMetadata.getTemporaryIdTableName
train
public function getTemporaryIdTableName() : string { $schema = $this->getSchemaName() === null ? '' : $this->getSchemaName() . '_'; // replace dots with underscores because PostgreSQL creates temporary tables in a special schema return $schema . $this->getTableName()...
php
{ "resource": "" }
q14576
ClassMetadata.setPropertyOverride
train
public function setPropertyOverride(Property $property) : void { $fieldName = $property->getName(); if (! isset($this->declaredProperties[$fieldName])) { throw MappingException::invalidOverrideFieldName($this->className, $fieldName); } $originalProperty = $this...
php
{ "resource": "" }
q14577
ClassMetadata.isInheritedProperty
train
public function isInheritedProperty($fieldName) { $declaringClass = $this->declaredProperties[$fieldName]->getDeclaringClass(); return $declaringClass->className !== $this->className; }
php
{ "resource": "" }
q14578
ClassMetadata.addProperty
train
public function addProperty(Property $property) { $fieldName = $property->getName(); // Check for empty field name if (empty($fieldName)) { throw MappingException::missingFieldName($this->className); } $property->setDeclaringClass($this); switch (true) ...
php
{ "resource": "" }
q14579
ArrayHydrator.updateResultPointer
train
private function updateResultPointer(array &$coll, $index, $dqlAlias, $oneToOne) { if ($coll === null) { unset($this->resultPointers[$dqlAlias]); // Ticket #1228 return; } if ($oneToOne) { $this->resultPointers[$dqlAlias] =& $coll; return; ...
php
{ "resource": "" }
q14580
LimitSubqueryOutputWalker.platformSupportsRowNumber
train
private function platformSupportsRowNumber() { return $this->platform instanceof PostgreSqlPlatform || $this->platform instanceof SQLServerPlatform || $this->platform instanceof OraclePlatform || $this->platform instanceof SQLAnywherePlatform || $this->platfor...
php
{ "resource": "" }
q14581
LimitSubqueryOutputWalker.walkSelectStatement
train
public function walkSelectStatement(SelectStatement $AST) { if ($this->platformSupportsRowNumber()) { return $this->walkSelectStatementWithRowNumber($AST); } return $this->walkSelectStatementWithoutRowNumber($AST); }
php
{ "resource": "" }
q14582
LimitSubqueryOutputWalker.walkSelectStatementWithoutRowNumber
train
public function walkSelectStatementWithoutRowNumber(SelectStatement $AST, $addMissingItemsFromOrderByToSelect = true) { // We don't want to call this recursively! if ($AST->orderByClause instanceof OrderByClause && $addMissingItemsFromOrderByToSelect) { // In the case of ordering a query...
php
{ "resource": "" }
q14583
LimitSubqueryOutputWalker.addMissingItemsFromOrderByToSelect
train
private function addMissingItemsFromOrderByToSelect(SelectStatement $AST) { $this->orderByPathExpressions = []; // We need to do this in another walker because otherwise we'll end up // polluting the state of this one. $walker = clone $this; // This will populate $orderByPa...
php
{ "resource": "" }
q14584
LimitSubqueryOutputWalker.recreateInnerSql
train
private function recreateInnerSql( OrderByClause $orderByClause, array $identifiers, string $innerSql ) : string { [$searchPatterns, $replacements] = $this->generateSqlAliasReplacements(); $orderByItems = []; foreach ($orderByClause->orderByItems as $orderByItem) { ...
php
{ "resource": "" }
q14585
AbstractCollectionPersister.evictCollectionCache
train
protected function evictCollectionCache(PersistentCollection $collection) { $key = new CollectionCacheKey( $this->sourceEntity->getRootClassName(), $this->association->getName(), $this->uow->getEntityIdentifier($collection->getOwner()) ); $this->region->e...
php
{ "resource": "" }
q14586
AnnotationDriver.convertJoinTableAnnotationToJoinTableMetadata
train
private function convertJoinTableAnnotationToJoinTableMetadata( Annotation\JoinTable $joinTableAnnot ) : Mapping\JoinTableMetadata { $joinTable = new Mapping\JoinTableMetadata(); if (! empty($joinTableAnnot->name)) { $joinTable->setName($joinTableAnnot->name); } ...
php
{ "resource": "" }
q14587
AnnotationDriver.getCascade
train
private function getCascade(string $className, string $fieldName, array $originalCascades) { $cascadeTypes = ['remove', 'persist', 'refresh']; $cascades = array_map('strtolower', $originalCascades); if (in_array('all', $cascades, true)) { $cascades = $cascadeTypes; }...
php
{ "resource": "" }
q14588
EntityManager.clear
train
public function clear($entityName = null) { $this->unitOfWork->clear(); $this->unitOfWork = new UnitOfWork($this); if ($this->eventManager->hasListeners(Events::onClear)) { $this->eventManager->dispatchEvent(Events::onClear, new Event\OnClearEventArgs($this)); } }
php
{ "resource": "" }
q14589
EntityManager.persist
train
public function persist($entity) { if (! is_object($entity)) { throw ORMInvalidArgumentException::invalidObject('EntityManager#persist()', $entity); } $this->errorIfClosed(); $this->unitOfWork->persist($entity); }
php
{ "resource": "" }
q14590
EntityManager.refresh
train
public function refresh($entity) { if (! is_object($entity)) { throw ORMInvalidArgumentException::invalidObject('EntityManager#refresh()', $entity); } $this->errorIfClosed(); $this->unitOfWork->refresh($entity); }
php
{ "resource": "" }
q14591
EntityManager.contains
train
public function contains($entity) { return $this->unitOfWork->isScheduledForInsert($entity) || ($this->unitOfWork->isInIdentityMap($entity) && ! $this->unitOfWork->isScheduledForDelete($entity)); }
php
{ "resource": "" }
q14592
EntityManager.createConnection
train
protected static function createConnection($connection, Configuration $config, ?EventManager $eventManager = null) { if (is_array($connection)) { return DriverManager::getConnection($connection, $config, $eventManager ?: new EventManager()); } if (! $connection instanceof Connec...
php
{ "resource": "" }
q14593
MappingDescribeCommand.getClassMetadata
train
private function getClassMetadata($entityName, EntityManagerInterface $entityManager) { try { return $entityManager->getClassMetadata($entityName); } catch (MappingException $e) { } $matches = array_filter( $this->getMappedEntities($entityManager), ...
php
{ "resource": "" }
q14594
MappingDescribeCommand.formatValue
train
private function formatValue($value) { if ($value === '') { return ''; } if ($value === null) { return '<comment>Null</comment>'; } if (is_bool($value)) { return '<comment>' . ($value ? 'True' : 'False') . '</comment>'; } ...
php
{ "resource": "" }
q14595
MappingDescribeCommand.formatField
train
private function formatField($label, $value) { if ($value === null) { $value = '<comment>None</comment>'; } return [sprintf('<info>%s</info>', $label), $this->formatValue($value)]; }
php
{ "resource": "" }
q14596
MappingDescribeCommand.formatPropertyMappings
train
private function formatPropertyMappings(iterable $propertyMappings) { $output = []; foreach ($propertyMappings as $propertyName => $property) { $output[] = $this->formatField(sprintf(' %s', $propertyName), ''); if ($property instanceof FieldMetadata) { $out...
php
{ "resource": "" }
q14597
Autoloader.resolveFile
train
public static function resolveFile(string $metadataDir, string $metadataNamespace, string $className) : string { if (strpos($className, $metadataNamespace) !== 0) { throw new InvalidArgumentException( sprintf('The class "%s" is not part of the metadata namespace "%s"', $className...
php
{ "resource": "" }
q14598
Autoloader.register
train
public static function register( string $metadataDir, string $metadataNamespace, ?callable $notFoundCallback = null ) : Closure { $metadataNamespace = ltrim($metadataNamespace, '\\'); if (! ($notFoundCallback === null || is_callable($notFoundCallback))) { $type =...
php
{ "resource": "" }
q14599
HydrationCompleteHandler.deferPostLoadInvoking
train
public function deferPostLoadInvoking(ClassMetadata $class, $entity) { $invoke = $this->listenersInvoker->getSubscribedSystems($class, Events::postLoad); if ($invoke === ListenersInvoker::INVOKE_NONE) { return; } $this->deferredPostLoadInvocations[] = [$class, $invoke, ...
php
{ "resource": "" }