repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php
DocumentPersister.loadEmbedManyCollection
private function loadEmbedManyCollection(PersistentCollectionInterface $collection) { $rawData = $collection->getRawData(); if ($rawData) { $mapping = $collection->getMapping(); $owner = $collection->getOwner(); foreach ($rawData as $key => $data) { if ($mapping->type === Type::MAP) { $key = (string)$key; } else { $key = (int)$key; } $embeddedDocument = $this->uow->getAssociationPersister()->loadEmbed($mapping, $data, $owner, $key, $collection->isReadOnly()); if ($mapping->type === Type::MAP) { $collection->set($key, $embeddedDocument); } else { $collection->add($embeddedDocument); } } } }
php
private function loadEmbedManyCollection(PersistentCollectionInterface $collection) { $rawData = $collection->getRawData(); if ($rawData) { $mapping = $collection->getMapping(); $owner = $collection->getOwner(); foreach ($rawData as $key => $data) { if ($mapping->type === Type::MAP) { $key = (string)$key; } else { $key = (int)$key; } $embeddedDocument = $this->uow->getAssociationPersister()->loadEmbed($mapping, $data, $owner, $key, $collection->isReadOnly()); if ($mapping->type === Type::MAP) { $collection->set($key, $embeddedDocument); } else { $collection->add($embeddedDocument); } } } }
@param PersistentCollectionInterface $collection @return void
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L418-L442
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php
DocumentPersister.loadReferenceManyCollectionInverseSide
private function loadReferenceManyCollectionInverseSide(PersistentCollectionInterface $collection) { $query = $this->createReferenceInverseSideQuery($collection->getMapping(), $collection->getOwner()); $documents = $query->execute()->toArray(); foreach ($documents as $key => $document) { $collection->add($document); } }
php
private function loadReferenceManyCollectionInverseSide(PersistentCollectionInterface $collection) { $query = $this->createReferenceInverseSideQuery($collection->getMapping(), $collection->getOwner()); $documents = $query->execute()->toArray(); foreach ($documents as $key => $document) { $collection->add($document); } }
Populate an inverse-side ReferenceMany association. @param PersistentCollectionInterface $collection @return void
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L451-L459
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php
DocumentPersister.loadReferenceManyCollectionOwningSide
private function loadReferenceManyCollectionOwningSide(PersistentCollectionInterface $collection) { $mapping = $collection->getMapping(); /** @var Identifier[] $identifiers */ $identifiers = array_map( function ($referenceData) use ($mapping) { return $this->ap->loadReference($mapping, $referenceData); }, $collection->getRawData() ); //reverse + limit must be applied here rather than on the query, //since we are potentially performing multiple queries if ($mapping->reverse) { $identifiers = array_reverse($identifiers); } if ($mapping->limit !== null) { $identifiers = array_slice($identifiers, 0, $mapping->limit); } //build document proxies and group by class $groupedIds = []; foreach ($identifiers as $key => $identifier) { //create a reference to the class+id and add it to the collection $reference = $identifier->getDocument($this->dm); if ($mapping->type === Type::MAP) { $collection->set($key, $reference); } else { $collection->add($reference); } //only query for the referenced object if it is not already initialized if ($reference instanceof Proxy && !$reference->__isInitialized__) { $className = $identifier->class->name; $groupedIds[$className][] = $identifier; } } //load documents foreach ($groupedIds as $className => $batch) { $class = $this->dm->getClassMetadata($className); $filters = array_merge( [(array)$mapping->criteria], $this->dm->getFilterCollection()->getFilterCriteria($class) ); $qb = $this->dm->createQueryBuilder($className); if (!empty($filters)) { //filters require a full table scan //TODO: needs documentation //add identifiers to the query as OR conditions /** @var Identifier $identifier */ foreach ($batch as $identifier) { $expr = $qb->expr(); $identifier->addToQueryCondition($expr); $qb->addOr($expr); } //add any other filter criteria foreach ($filters as $filter) { $qb->addCriteria($filter); } $query = $qb->getQuery(); } else { //load using batchgetitem foreach ($batch as $identifier) { $qb->get()->setIdentifier($identifier)->batch(); } $query = $qb->getBatch(); } foreach ($query->getMarshalledResult() as $documentData) { $identifier = $class->createIdentifier($documentData); $document = $this->uow->getByIdentifier($identifier); if ($document instanceof Proxy && !$document->__isInitialized()) { $data = $this->hydratorFactory->hydrate($document, $documentData); $this->uow->setOriginalDocumentData($document, $data); $document->__isInitialized__ = true; } } } }
php
private function loadReferenceManyCollectionOwningSide(PersistentCollectionInterface $collection) { $mapping = $collection->getMapping(); /** @var Identifier[] $identifiers */ $identifiers = array_map( function ($referenceData) use ($mapping) { return $this->ap->loadReference($mapping, $referenceData); }, $collection->getRawData() ); //reverse + limit must be applied here rather than on the query, //since we are potentially performing multiple queries if ($mapping->reverse) { $identifiers = array_reverse($identifiers); } if ($mapping->limit !== null) { $identifiers = array_slice($identifiers, 0, $mapping->limit); } //build document proxies and group by class $groupedIds = []; foreach ($identifiers as $key => $identifier) { //create a reference to the class+id and add it to the collection $reference = $identifier->getDocument($this->dm); if ($mapping->type === Type::MAP) { $collection->set($key, $reference); } else { $collection->add($reference); } //only query for the referenced object if it is not already initialized if ($reference instanceof Proxy && !$reference->__isInitialized__) { $className = $identifier->class->name; $groupedIds[$className][] = $identifier; } } //load documents foreach ($groupedIds as $className => $batch) { $class = $this->dm->getClassMetadata($className); $filters = array_merge( [(array)$mapping->criteria], $this->dm->getFilterCollection()->getFilterCriteria($class) ); $qb = $this->dm->createQueryBuilder($className); if (!empty($filters)) { //filters require a full table scan //TODO: needs documentation //add identifiers to the query as OR conditions /** @var Identifier $identifier */ foreach ($batch as $identifier) { $expr = $qb->expr(); $identifier->addToQueryCondition($expr); $qb->addOr($expr); } //add any other filter criteria foreach ($filters as $filter) { $qb->addCriteria($filter); } $query = $qb->getQuery(); } else { //load using batchgetitem foreach ($batch as $identifier) { $qb->get()->setIdentifier($identifier)->batch(); } $query = $qb->getBatch(); } foreach ($query->getMarshalledResult() as $documentData) { $identifier = $class->createIdentifier($documentData); $document = $this->uow->getByIdentifier($identifier); if ($document instanceof Proxy && !$document->__isInitialized()) { $data = $this->hydratorFactory->hydrate($document, $documentData); $this->uow->setOriginalDocumentData($document, $data); $document->__isInitialized__ = true; } } } }
Populate an owning-side ReferenceMany association. @param PersistentCollectionInterface $collection @return void
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L468-L556
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php
DocumentPersister.loadReferenceManyWithRepositoryMethod
private function loadReferenceManyWithRepositoryMethod(PersistentCollectionInterface $collection) { $iterator = $this->createReferenceManyWithRepositoryMethodIterator($collection); $mapping = $collection->getMapping(); $documents = $iterator->toArray(); foreach ($documents as $key => $obj) { if ($mapping->type === Type::MAP) { $collection->set($key, $obj); } else { $collection->add($obj); } } }
php
private function loadReferenceManyWithRepositoryMethod(PersistentCollectionInterface $collection) { $iterator = $this->createReferenceManyWithRepositoryMethodIterator($collection); $mapping = $collection->getMapping(); $documents = $iterator->toArray(); foreach ($documents as $key => $obj) { if ($mapping->type === Type::MAP) { $collection->set($key, $obj); } else { $collection->add($obj); } } }
Populate a ReferenceMany association with a custom repository method. @param PersistentCollectionInterface $collection @return void
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L565-L577
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php
DocumentPersister.lock
public function lock($document, $lockMode) { $qb = $this->dm->createQueryBuilder($this->class->name); $identifier = $this->uow->getDocumentIdentifier($document); $lockMapping = $this->class->lockMetadata; $qb->update(); $qb->setIdentifier($identifier); $qb->attr($lockMapping->name)->set($lockMode); $qb->getQuery()->execute(); $lockMapping->setValue($document, $lockMode); }
php
public function lock($document, $lockMode) { $qb = $this->dm->createQueryBuilder($this->class->name); $identifier = $this->uow->getDocumentIdentifier($document); $lockMapping = $this->class->lockMetadata; $qb->update(); $qb->setIdentifier($identifier); $qb->attr($lockMapping->name)->set($lockMode); $qb->getQuery()->execute(); $lockMapping->setValue($document, $lockMode); }
Locks document by storing the lock mode on the mapped lock attribute. @param object $document @param int $lockMode @return void
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L587-L600
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php
DocumentPersister.refresh
public function refresh(Identifier $identifier, $document) { $qb = $this->dm->createQueryBuilder($this->class->name); $query = $qb->get()->setIdentifier($identifier)->getQuery(); $data = $query->getSingleMarshalledResult(); $data = $this->hydratorFactory->hydrate($document, $data); $this->uow->setOriginalDocumentData($document, $data); }
php
public function refresh(Identifier $identifier, $document) { $qb = $this->dm->createQueryBuilder($this->class->name); $query = $qb->get()->setIdentifier($identifier)->getQuery(); $data = $query->getSingleMarshalledResult(); $data = $this->hydratorFactory->hydrate($document, $data); $this->uow->setOriginalDocumentData($document, $data); }
Refreshes a managed document. @param Identifier $identifier The identifier of the document. @param object $document The document to refresh. @return void
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L610-L618
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php
DocumentPersister.unlock
public function unlock($document) { $qb = $this->dm->createQueryBuilder($this->class->name); $identifier = $this->uow->getDocumentIdentifier($document); $lockMapping = $this->class->lockMetadata; $qb->update(); $qb->setIdentifier($identifier); $qb->attr($lockMapping->name)->remove(); $qb->getQuery()->execute(); $lockMapping->setValue($document, null); }
php
public function unlock($document) { $qb = $this->dm->createQueryBuilder($this->class->name); $identifier = $this->uow->getDocumentIdentifier($document); $lockMapping = $this->class->lockMetadata; $qb->update(); $qb->setIdentifier($identifier); $qb->attr($lockMapping->name)->remove(); $qb->getQuery()->execute(); $lockMapping->setValue($document, null); }
Releases any lock that exists on this document. @param object $document @return void
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L627-L640
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php
DocumentPersister.update
public function update($document, $parentPath = null) { $class = $this->dm->getClassMetadata(get_class($document)); $changeset = $this->uow->getDocumentChangeSet($document); if (!$class->isEmbeddedDocument) { $qb = $this->dm->createQueryBuilder($class->name); $identifier = $class->createIdentifier($document); $qb->update(); $qb->setIdentifier($identifier); } elseif ($parentPath === null) { throw new \InvalidArgumentException; } foreach ($changeset as $attributeName => $change) { list($old, $new) = $change; $mapping = $class->getPropertyMetadata($attributeName); $discriminatorValue = null; if ($mapping->embedded && $mapping->isOne()) { $embeddedClassName = get_class($new); $embeddedClass = $this->dm->getClassMetadata($embeddedClassName); $discriminatorValue = $embeddedClass->getEmbeddedDiscriminatorValue($mapping, $new); //@Many will set discriminator in updatePath } if ($class->isEmbeddedDocument) { $path = $parentPath->map($attributeName, $discriminatorValue); } else { $path = $qb->attr($attributeName, $discriminatorValue); } $this->updatePath($path, $old, $new, false); } // collections that aren't dirty but could be subject to update are // excluded from change set, let's go through them now foreach ($this->uow->getScheduledCollections($document) as $coll) { $mapping = $coll->getMapping(); /** @var RootPath $path */ list(, $path,) = $this->cp->getQueryPathAndParent($coll, $qb); if ($mapping->strategy === PropertyMetadata::STORAGE_STRATEGY_ATOMIC_SET && $this->uow->isCollectionScheduledForUpdate($coll)) { $path->set($coll); } elseif ($mapping->strategy === PropertyMetadata::STORAGE_STRATEGY_ATOMIC_SET && $this->uow->isCollectionScheduledForDeletion($coll)) { $path->remove(); $this->uow->unscheduleCollectionDeletion($coll); } // @ReferenceMany is handled by CollectionPersister } // Include versioning logic to set the new version value in the database // and to ensure the version has not changed since this document object instance // was fetched from the database $nextVersion = null; if ($this->class->isVersioned) { //verisoning is only supported on top-level documents $versionMapping = $this->class->getPropertyMetadata($this->class->versionAttribute); $currentVersion = $versionMapping->getValue($document); $path = $qb->attr($versionMapping->name); //add a query condition for the current version $path->equals($currentVersion); if ($versionMapping->type === Type::INT) { $nextVersion = $currentVersion + 1; $path->set($path, Set::MODIFIER_PLUS, 1); } elseif ($versionMapping->isDateType()) { $nextVersion = new \DateTime(); $path->set($nextVersion); } } if (!$class->isEmbeddedDocument) { if ($qb->expr->update->count() > 0) { // Include locking logic so that if the document object in memory is currently // locked then it will remove it, otherwise it ensures the document is not locked. if ($this->class->isLockable) { $lockMapping = $this->class->lockMetadata; $isLocked = $lockMapping->getValue($document); $attribute = $qb->attr($lockMapping->name); if ($isLocked) { $attribute->remove(); } else { $attribute->exists(false); } } try { $qb->getQuery()->execute(); } catch (\Aws\DynamoDb\Exception\DynamoDbException $e) { if (($this->class->isVersioned || $this->class->isLockable) && $e->getAwsErrorCode() === 'ConditionalCheckFailedException') { throw LockException::lockFailed($document); } throw $e; } if ($this->class->isVersioned) { $versionMapping = $this->class->getPropertyMetadata($this->class->versionAttribute); $versionMapping->setValue($document, $nextVersion); } } $this->handleCollections($document); } }
php
public function update($document, $parentPath = null) { $class = $this->dm->getClassMetadata(get_class($document)); $changeset = $this->uow->getDocumentChangeSet($document); if (!$class->isEmbeddedDocument) { $qb = $this->dm->createQueryBuilder($class->name); $identifier = $class->createIdentifier($document); $qb->update(); $qb->setIdentifier($identifier); } elseif ($parentPath === null) { throw new \InvalidArgumentException; } foreach ($changeset as $attributeName => $change) { list($old, $new) = $change; $mapping = $class->getPropertyMetadata($attributeName); $discriminatorValue = null; if ($mapping->embedded && $mapping->isOne()) { $embeddedClassName = get_class($new); $embeddedClass = $this->dm->getClassMetadata($embeddedClassName); $discriminatorValue = $embeddedClass->getEmbeddedDiscriminatorValue($mapping, $new); //@Many will set discriminator in updatePath } if ($class->isEmbeddedDocument) { $path = $parentPath->map($attributeName, $discriminatorValue); } else { $path = $qb->attr($attributeName, $discriminatorValue); } $this->updatePath($path, $old, $new, false); } // collections that aren't dirty but could be subject to update are // excluded from change set, let's go through them now foreach ($this->uow->getScheduledCollections($document) as $coll) { $mapping = $coll->getMapping(); /** @var RootPath $path */ list(, $path,) = $this->cp->getQueryPathAndParent($coll, $qb); if ($mapping->strategy === PropertyMetadata::STORAGE_STRATEGY_ATOMIC_SET && $this->uow->isCollectionScheduledForUpdate($coll)) { $path->set($coll); } elseif ($mapping->strategy === PropertyMetadata::STORAGE_STRATEGY_ATOMIC_SET && $this->uow->isCollectionScheduledForDeletion($coll)) { $path->remove(); $this->uow->unscheduleCollectionDeletion($coll); } // @ReferenceMany is handled by CollectionPersister } // Include versioning logic to set the new version value in the database // and to ensure the version has not changed since this document object instance // was fetched from the database $nextVersion = null; if ($this->class->isVersioned) { //verisoning is only supported on top-level documents $versionMapping = $this->class->getPropertyMetadata($this->class->versionAttribute); $currentVersion = $versionMapping->getValue($document); $path = $qb->attr($versionMapping->name); //add a query condition for the current version $path->equals($currentVersion); if ($versionMapping->type === Type::INT) { $nextVersion = $currentVersion + 1; $path->set($path, Set::MODIFIER_PLUS, 1); } elseif ($versionMapping->isDateType()) { $nextVersion = new \DateTime(); $path->set($nextVersion); } } if (!$class->isEmbeddedDocument) { if ($qb->expr->update->count() > 0) { // Include locking logic so that if the document object in memory is currently // locked then it will remove it, otherwise it ensures the document is not locked. if ($this->class->isLockable) { $lockMapping = $this->class->lockMetadata; $isLocked = $lockMapping->getValue($document); $attribute = $qb->attr($lockMapping->name); if ($isLocked) { $attribute->remove(); } else { $attribute->exists(false); } } try { $qb->getQuery()->execute(); } catch (\Aws\DynamoDb\Exception\DynamoDbException $e) { if (($this->class->isVersioned || $this->class->isLockable) && $e->getAwsErrorCode() === 'ConditionalCheckFailedException') { throw LockException::lockFailed($document); } throw $e; } if ($this->class->isVersioned) { $versionMapping = $this->class->getPropertyMetadata($this->class->versionAttribute); $versionMapping->setValue($document, $nextVersion); } } $this->handleCollections($document); } }
Updates the already persisted document if it has any new changesets. @param object $document @param RootPath|null $parentPath For embedded documents, the QueryBuilder object representing the top-level document path. @return void @throws LockException
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L653-L765
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php
DocumentPersister.upsert
public function upsert($document, $parentPath = null) { $class = $this->dm->getClassMetadata(get_class($document)); $changeset = $this->uow->getDocumentChangeSet($document); if (!$class->isEmbeddedDocument) { $qb = $this->dm->createQueryBuilder($class->name); $identifier = $class->createIdentifier($document); $qb->update(); $qb->setIdentifier($identifier); } elseif ($parentPath === null) { throw new \InvalidArgumentException; } foreach ($changeset as $attributeName => $change) { if ($class->isIdentifier($attributeName)) { continue; } list($old, $new) = $change; $mapping = $class->getPropertyMetadata($attributeName); $discriminatorValue = null; if ($mapping->embedded && $mapping->isOne()) { $embeddedClassName = get_class($new); $embeddedClass = $this->dm->getClassMetadata($embeddedClassName); $discriminatorValue = $embeddedClass->getEmbeddedDiscriminatorValue($mapping, $new); //@Many will set discriminator in updatePath } if ($class->isEmbeddedDocument) { $path = $parentPath->map($attributeName, $discriminatorValue); } else { $path = $qb->attr($attributeName, $discriminatorValue); } $this->updatePath($path, $old, $new, true); } // add discriminator if the class has one if ($class->discriminatorAttribute !== null) { if ($class->isEmbeddedDocument) { $path = $parentPath->map($class->discriminatorAttribute); } else { $path = $qb->attr($class->discriminatorAttribute); } $path->set( $class->discriminatorValue !== null ? $class->discriminatorValue : $class->name ); } if ($this->class->isVersioned) { // Set the initial version. Only supported on top-level documents. $versionMapping = $this->class->getPropertyMetadata($this->class->versionAttribute); $nextVersion = null; if ($versionMapping->type === Type::INT) { $nextVersion = max(1, (int)$versionMapping->getValue($document)); } elseif ($versionMapping->isDateType()) { $nextVersion = new \DateTime(); } $nextVersion = $versionMapping->getType()->convertToDatabaseValue($nextVersion); $versionMapping->setValue($document, $nextVersion); $qb->attr($versionMapping->name)->set($nextVersion); } //DynamoDB will upsert even if we only pass the id conditional with no UpdateExpression if (!$class->isEmbeddedDocument) { $qb->getQuery()->execute(); } }
php
public function upsert($document, $parentPath = null) { $class = $this->dm->getClassMetadata(get_class($document)); $changeset = $this->uow->getDocumentChangeSet($document); if (!$class->isEmbeddedDocument) { $qb = $this->dm->createQueryBuilder($class->name); $identifier = $class->createIdentifier($document); $qb->update(); $qb->setIdentifier($identifier); } elseif ($parentPath === null) { throw new \InvalidArgumentException; } foreach ($changeset as $attributeName => $change) { if ($class->isIdentifier($attributeName)) { continue; } list($old, $new) = $change; $mapping = $class->getPropertyMetadata($attributeName); $discriminatorValue = null; if ($mapping->embedded && $mapping->isOne()) { $embeddedClassName = get_class($new); $embeddedClass = $this->dm->getClassMetadata($embeddedClassName); $discriminatorValue = $embeddedClass->getEmbeddedDiscriminatorValue($mapping, $new); //@Many will set discriminator in updatePath } if ($class->isEmbeddedDocument) { $path = $parentPath->map($attributeName, $discriminatorValue); } else { $path = $qb->attr($attributeName, $discriminatorValue); } $this->updatePath($path, $old, $new, true); } // add discriminator if the class has one if ($class->discriminatorAttribute !== null) { if ($class->isEmbeddedDocument) { $path = $parentPath->map($class->discriminatorAttribute); } else { $path = $qb->attr($class->discriminatorAttribute); } $path->set( $class->discriminatorValue !== null ? $class->discriminatorValue : $class->name ); } if ($this->class->isVersioned) { // Set the initial version. Only supported on top-level documents. $versionMapping = $this->class->getPropertyMetadata($this->class->versionAttribute); $nextVersion = null; if ($versionMapping->type === Type::INT) { $nextVersion = max(1, (int)$versionMapping->getValue($document)); } elseif ($versionMapping->isDateType()) { $nextVersion = new \DateTime(); } $nextVersion = $versionMapping->getType()->convertToDatabaseValue($nextVersion); $versionMapping->setValue($document, $nextVersion); $qb->attr($versionMapping->name)->set($nextVersion); } //DynamoDB will upsert even if we only pass the id conditional with no UpdateExpression if (!$class->isEmbeddedDocument) { $qb->getQuery()->execute(); } }
Update a document if it already exists in DynamoDB, or insert if it does not. @param object $document @param RootPath|null $parentPath For embedded documents, the QueryBuilder object representing the top-level document path. @return void
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L881-L960
mtils/cmsable
src/Cmsable/Routing/ControllerDispatcher.php
ControllerDispatcher.dispatch
public function dispatch(Route $route, $controller, $method) { // This is not very nice but with the current structure we have to throw // the previously created controller away. // For further implementations more cleanup has to be done $instance = $this->makeController(is_object($controller) ? get_class($controller) : $controller); $parameters = $this->resolveClassMethodDependencies( $route->parametersWithoutNulls(), $instance, $method ); if ($this->creator && method_exists($this->creator, 'modifyMethodParameters')) { $this->creator->modifyMethodParameters($instance, $method, $parameters); } if (method_exists($instance, 'callAction')) { return $instance->callAction($method, $parameters); } return $instance->{$method}(...array_values($parameters)); }
php
public function dispatch(Route $route, $controller, $method) { // This is not very nice but with the current structure we have to throw // the previously created controller away. // For further implementations more cleanup has to be done $instance = $this->makeController(is_object($controller) ? get_class($controller) : $controller); $parameters = $this->resolveClassMethodDependencies( $route->parametersWithoutNulls(), $instance, $method ); if ($this->creator && method_exists($this->creator, 'modifyMethodParameters')) { $this->creator->modifyMethodParameters($instance, $method, $parameters); } if (method_exists($instance, 'callAction')) { return $instance->callAction($method, $parameters); } return $instance->{$method}(...array_values($parameters)); }
Dispatch a request to a given controller and method. @param \Illuminate\Routing\Route $route @param mixed $controller @param string $method @return mixed
https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Routing/ControllerDispatcher.php#L26-L48
mtils/cmsable
src/Cmsable/Routing/ControllerDispatcher.php
ControllerDispatcher.makeController
protected function makeController($controller) { if (!$this->creator) { return $this->container->make($controller); } return $this->creator->createController($controller, $this->getPage()); }
php
protected function makeController($controller) { if (!$this->creator) { return $this->container->make($controller); } return $this->creator->createController($controller, $this->getPage()); }
Make a controller instance via the IoC container. @param string $controller @return mixed
https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Routing/ControllerDispatcher.php#L82-L91
mtils/cmsable
src/Cmsable/Routing/ControllerDispatcher.php
ControllerDispatcher.call
protected function call($instance, $route, $method) { $parameters = $this->resolveClassMethodDependencies( $route->parametersWithoutNulls(), $instance, $method ); if ($this->creator && method_exists($this->creator, 'modifyMethodParameters')) { $this->creator->modifyMethodParameters($instance, $method, $parameters); } return $instance->callAction($method, $parameters); }
php
protected function call($instance, $route, $method) { $parameters = $this->resolveClassMethodDependencies( $route->parametersWithoutNulls(), $instance, $method ); if ($this->creator && method_exists($this->creator, 'modifyMethodParameters')) { $this->creator->modifyMethodParameters($instance, $method, $parameters); } return $instance->callAction($method, $parameters); }
Call the given controller instance method. @param \Illuminate\Routing\Controller $instance @param \Illuminate\Routing\Route $route @param string $method @return mixed
https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Routing/ControllerDispatcher.php#L101-L112
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Schema/Identifier/Identifier.php
Identifier.addNotExistsToQueryCondition
public function addNotExistsToQueryCondition(Expr $expr) { $expr->attr($this->getHashKey()->getPropertyMetadata()->name)->exists(false); }
php
public function addNotExistsToQueryCondition(Expr $expr) { $expr->attr($this->getHashKey()->getPropertyMetadata()->name)->exists(false); }
Add an attribute_not_exists() condition for this identifier to the provided query expression. @param Expr $expr @return void
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Schema/Identifier/Identifier.php#L48-L51
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Schema/Identifier/Identifier.php
Identifier.addToQueryCondition
public function addToQueryCondition(Expr $expr) { $expr->attr($this->getHashKey()->getPropertyMetadata()->name)->equals($this->getHashValue()); }
php
public function addToQueryCondition(Expr $expr) { $expr->attr($this->getHashKey()->getPropertyMetadata()->name)->equals($this->getHashValue()); }
Add a conditon for this identifer's values to the provided query expression. @param Expr $expr @return void
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Schema/Identifier/Identifier.php#L75-L78
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Schema/Identifier/Identifier.php
Identifier.getDocument
public function getDocument(DocumentManager $dm) { // Check identity map first, if its already in there just return it. $document = $dm->getUnitOfWork()->tryGetByIdentifier($this); if ($document !== false) { return $document; } $document = $dm->getProxyFactory()->getProxy($this->class->getName(), $this->getArray()); $dm->getUnitOfWork()->registerManaged($document, $this, []); return $document; }
php
public function getDocument(DocumentManager $dm) { // Check identity map first, if its already in there just return it. $document = $dm->getUnitOfWork()->tryGetByIdentifier($this); if ($document !== false) { return $document; } $document = $dm->getProxyFactory()->getProxy($this->class->getName(), $this->getArray()); $dm->getUnitOfWork()->registerManaged($document, $this, []); return $document; }
Gets a reference to the target document without actually loading it. If partial objects are allowed, this method will return a partial object that only has its identifier populated. Otherwise a proxy is returned that automatically loads itself on first access. @param DocumentManager $dm @return object The document reference.
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Schema/Identifier/Identifier.php#L113-L125
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Schema/Identifier/Identifier.php
Identifier.getDocumentPartial
public function getDocumentPartial(DocumentManager $dm) { // Check identity map first, if its already in there just return it. $document = $dm->getUnitOfWork()->tryGetByIdentifier($this); if ($document !== false) { return $document; } $document = $this->class->newInstance(); $this->addToDocument($document); $dm->getUnitOfWork()->registerManaged($document, $this, []); return $document; }
php
public function getDocumentPartial(DocumentManager $dm) { // Check identity map first, if its already in there just return it. $document = $dm->getUnitOfWork()->tryGetByIdentifier($this); if ($document !== false) { return $document; } $document = $this->class->newInstance(); $this->addToDocument($document); $dm->getUnitOfWork()->registerManaged($document, $this, []); return $document; }
Gets a partial reference to the target document without actually loading it, if the document is not yet loaded. The returned reference may be a partial object if the document is not yet loaded/managed. If it is a partial object it will not initialize the rest of the document state on access. Thus you can only ever safely access the identifier of a document obtained through this method. The use-cases for partial references involve maintaining bidirectional associations without loading one side of the association or to update a document without loading it. Note, however, that in the latter case the original (persistent) document data will never be visible to the application (especially not event listeners) as it will never be loaded in the first place. @param DocumentManager $dm @return object The (partial) document reference.
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Schema/Identifier/Identifier.php#L146-L159
GetOlympus/olympus-textarea-field
src/Textarea/Textarea.php
Textarea.getVars
protected function getVars($content, $details = []) { // Build defaults $defaults = [ 'id' => '', 'title' => Translate::t('textarea.title', [], 'textareafield'), 'default' => '', 'description' => '', 'placeholder' => '', 'rows' => 8, ]; // Build defaults data $vars = array_merge($defaults, $content); // Retrieve field value $vars['val'] = $this->getValue($content['id'], $details, $vars['default']); // Update vars $this->getModel()->setVars($vars); }
php
protected function getVars($content, $details = []) { // Build defaults $defaults = [ 'id' => '', 'title' => Translate::t('textarea.title', [], 'textareafield'), 'default' => '', 'description' => '', 'placeholder' => '', 'rows' => 8, ]; // Build defaults data $vars = array_merge($defaults, $content); // Retrieve field value $vars['val'] = $this->getValue($content['id'], $details, $vars['default']); // Update vars $this->getModel()->setVars($vars); }
Prepare HTML component. @param array $content @param array $details
https://github.com/GetOlympus/olympus-textarea-field/blob/b09455f01471e60baf82411f5b12f0d45ca13615/src/Textarea/Textarea.php#L39-L59
zhaoxianfang/tools
src/Symfony/Component/Config/FileLocator.php
FileLocator.locate
public function locate($name, $currentPath = null, $first = true) { if ('' == $name) { throw new \InvalidArgumentException('An empty file name is not valid to be located.'); } if ($this->isAbsolutePath($name)) { if (!file_exists($name)) { throw new FileLocatorFileNotFoundException(sprintf('The file "%s" does not exist.', $name), 0, null, array($name)); } return $name; } $paths = $this->paths; if (null !== $currentPath) { array_unshift($paths, $currentPath); } $paths = array_unique($paths); $filepaths = $notfound = array(); foreach ($paths as $path) { if (@file_exists($file = $path.DIRECTORY_SEPARATOR.$name)) { if (true === $first) { return $file; } $filepaths[] = $file; } else { $notfound[] = $file; } } if (!$filepaths) { throw new FileLocatorFileNotFoundException(sprintf('The file "%s" does not exist (in: %s).', $name, implode(', ', $paths)), 0, null, $notfound); } return $filepaths; }
php
public function locate($name, $currentPath = null, $first = true) { if ('' == $name) { throw new \InvalidArgumentException('An empty file name is not valid to be located.'); } if ($this->isAbsolutePath($name)) { if (!file_exists($name)) { throw new FileLocatorFileNotFoundException(sprintf('The file "%s" does not exist.', $name), 0, null, array($name)); } return $name; } $paths = $this->paths; if (null !== $currentPath) { array_unshift($paths, $currentPath); } $paths = array_unique($paths); $filepaths = $notfound = array(); foreach ($paths as $path) { if (@file_exists($file = $path.DIRECTORY_SEPARATOR.$name)) { if (true === $first) { return $file; } $filepaths[] = $file; } else { $notfound[] = $file; } } if (!$filepaths) { throw new FileLocatorFileNotFoundException(sprintf('The file "%s" does not exist (in: %s).', $name, implode(', ', $paths)), 0, null, $notfound); } return $filepaths; }
{@inheritdoc}
https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/Config/FileLocator.php#L36-L75
Beotie/Beotie-PSR7-stream
src/Stream/FileInfoComponent/MetadataComponent.php
MetadataComponent.getMetadata
public function getMetadata($key = null) { if (!$this->fileInfo) { return null; } $methods = get_class_methods($this->fileInfo); array_walk($methods, [$this, 'isMetadataMethod'], sprintf('/^get%s$/i', $key)); $methods = array_filter($methods); if (count($methods) !== 1) { $availables = array_filter(array_map([$this, 'getMetadataApplyable'], get_class_methods($this->fileInfo))); $message = 'Undefined getter for "%s" metadata. Availables are : [%s]'; throw new \RuntimeException(sprintf($message, $key, implode(', ', $availables))); } return $this->fileInfo->{$methods[array_keys($methods)[0]]}(); }
php
public function getMetadata($key = null) { if (!$this->fileInfo) { return null; } $methods = get_class_methods($this->fileInfo); array_walk($methods, [$this, 'isMetadataMethod'], sprintf('/^get%s$/i', $key)); $methods = array_filter($methods); if (count($methods) !== 1) { $availables = array_filter(array_map([$this, 'getMetadataApplyable'], get_class_methods($this->fileInfo))); $message = 'Undefined getter for "%s" metadata. Availables are : [%s]'; throw new \RuntimeException(sprintf($message, $key, implode(', ', $availables))); } return $this->fileInfo->{$methods[array_keys($methods)[0]]}(); }
Get stream metadata as an associative array or retrieve a specific key. The keys returned are identical to the keys returned from PHP's stream_get_meta_data() function. @param string $key Specific metadata to retrieve. @link http://php.net/manual/en/function.stream-get-meta-data.php @return array|mixed|null Returns an associative array if no key is provided. Returns a specific key value if a key is provided and the value is found, or null if the key is not found.
https://github.com/Beotie/Beotie-PSR7-stream/blob/8f4f4bfb8252e392fc17eed2a2b0682c4e9d08ca/src/Stream/FileInfoComponent/MetadataComponent.php#L54-L73
Beotie/Beotie-PSR7-stream
src/Stream/FileInfoComponent/MetadataComponent.php
MetadataComponent.isMetadataMethod
protected function isMetadataMethod(string &$subject, int $key, string $pattern) { unset($key); if (!preg_match($pattern, $subject)) { $subject = false; } return; }
php
protected function isMetadataMethod(string &$subject, int $key, string $pattern) { unset($key); if (!preg_match($pattern, $subject)) { $subject = false; } return; }
Is metadata method Update the method as subject is is not matching the given patter to false @param string $subject The subject @param int $key The subject key @param string $pattern The matching pattern @return void
https://github.com/Beotie/Beotie-PSR7-stream/blob/8f4f4bfb8252e392fc17eed2a2b0682c4e9d08ca/src/Stream/FileInfoComponent/MetadataComponent.php#L104-L112
shgysk8zer0/core_api
traits/magic/domdocument.php
DOMDocument._setRoot
final protected function _setRoot($node = 'root') { if (is_string($node)) { $this->body = $this->appendChild($this->createElement($node)); } elseif (is_object($node) and $node instanceof \DOMNode) { $this->body = $this->appendChild($node); } else { trigger_error( sprintf('$node must be either a DOMNode or string, %s given', gettype($node)), E_USER_WARNING ); } return $this; }
php
final protected function _setRoot($node = 'root') { if (is_string($node)) { $this->body = $this->appendChild($this->createElement($node)); } elseif (is_object($node) and $node instanceof \DOMNode) { $this->body = $this->appendChild($node); } else { trigger_error( sprintf('$node must be either a DOMNode or string, %s given', gettype($node)), E_USER_WARNING ); } return $this; }
Private method to set $this->root_el @param mixed $node Either node or node name to set as root element @return self
https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/magic/domdocument.php#L126-L139
shgysk8zer0/core_api
traits/magic/domdocument.php
DOMDocument._nodeBuilder
final protected function _nodeBuilder($key, $value = null, \DOMNode &$parent = null) { if (is_null($parent)) { $parent = $this; } if (is_string($key)) { if (substr($key, 0, 1) === '@' and (is_string($value) or is_numeric($value))) { $parent->setAttribute(substr($key, 1), $value); } else { $node = $parent->appendChild($this->createElement($key)); if (is_string($value)) { $node->appendChild($this->createTextNode($value)); } elseif ($value instanceof \DOMNode) { $node->appendChild($content); } elseif (is_array($value) or (is_object($value) and $value = get_object_vars($value))) { foreach ($value as $k => $v) { $this->{__FUNCTION__}($k, $v, $node); unset($k, $v); } } } } elseif (is_string($value)) { $parent->appendChild($this->createTextNode($value)); } elseif ($value instanceof \DOMNode) { $parent->appendChild($value); } elseif (is_array($value) or is_object($value) and $value = get_object_vars($value)) { foreach ($value as $k => $v) { $this->{__FUNCTION__}($k, $v, $node); unset($k, $v); } } }
php
final protected function _nodeBuilder($key, $value = null, \DOMNode &$parent = null) { if (is_null($parent)) { $parent = $this; } if (is_string($key)) { if (substr($key, 0, 1) === '@' and (is_string($value) or is_numeric($value))) { $parent->setAttribute(substr($key, 1), $value); } else { $node = $parent->appendChild($this->createElement($key)); if (is_string($value)) { $node->appendChild($this->createTextNode($value)); } elseif ($value instanceof \DOMNode) { $node->appendChild($content); } elseif (is_array($value) or (is_object($value) and $value = get_object_vars($value))) { foreach ($value as $k => $v) { $this->{__FUNCTION__}($k, $v, $node); unset($k, $v); } } } } elseif (is_string($value)) { $parent->appendChild($this->createTextNode($value)); } elseif ($value instanceof \DOMNode) { $parent->appendChild($value); } elseif (is_array($value) or is_object($value) and $value = get_object_vars($value)) { foreach ($value as $k => $v) { $this->{__FUNCTION__}($k, $v, $node); unset($k, $v); } } }
Dynamically and seemingly magically build nodes and append to parent @param mixed $key Int or string to become tagname of new node @param mixed $value String, array, sdtClass object, DOMNode @param \DOMNode $parent Parent element to append to (defaults to $this) @return void
https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/magic/domdocument.php#L149-L180
cubicmushroom/valueobjects
src/Structure/Collection.php
Collection.fromNative
public static function fromNative() { $array = \func_get_arg(0); $items = array(); foreach ($array as $item) { if ($item instanceof \Traversable || \is_array($item)) { $items[] = static::fromNative($item); } else { $items[] = new StringLiteral(\strval($item)); } } $fixedArray = \SplFixedArray::fromArray($items); return new static($fixedArray); }
php
public static function fromNative() { $array = \func_get_arg(0); $items = array(); foreach ($array as $item) { if ($item instanceof \Traversable || \is_array($item)) { $items[] = static::fromNative($item); } else { $items[] = new StringLiteral(\strval($item)); } } $fixedArray = \SplFixedArray::fromArray($items); return new static($fixedArray); }
Returns a new Collection object @param \SplFixedArray $array @return self
https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Structure/Collection.php#L21-L37
cubicmushroom/valueobjects
src/Structure/Collection.php
Collection.sameValueAs
public function sameValueAs(ValueObjectInterface $collection) { if (false === Util::classEquals($this, $collection) || false === $this->count()->sameValueAs($collection->count())) { return false; } $arrayCollection = $collection->toArray(); foreach ($this->items as $index => $item) { if (!isset($arrayCollection[$index]) || false === $item->sameValueAs($arrayCollection[$index])) { return false; } } return true; }
php
public function sameValueAs(ValueObjectInterface $collection) { if (false === Util::classEquals($this, $collection) || false === $this->count()->sameValueAs($collection->count())) { return false; } $arrayCollection = $collection->toArray(); foreach ($this->items as $index => $item) { if (!isset($arrayCollection[$index]) || false === $item->sameValueAs($arrayCollection[$index])) { return false; } } return true; }
Tells whether two Collection are equal by comparing their size and items (item order matters) @param ValueObjectInterface $collection @return bool
https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Structure/Collection.php#L62-L77
cubicmushroom/valueobjects
src/Structure/Collection.php
Collection.contains
public function contains(ValueObjectInterface $object) { foreach ($this->items as $item) { if ($item->sameValueAs($object)) { return true; } } return false; }
php
public function contains(ValueObjectInterface $object) { foreach ($this->items as $item) { if ($item->sameValueAs($object)) { return true; } } return false; }
Tells whether the Collection contains an object @param ValueObjectInterface $object @return bool
https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Structure/Collection.php#L95-L104
irfantoor/engine
src/Http/Response.php
Response.getReasonPhrase
public function getReasonPhrase() { if ($this->phrase) return $this->phrase; if (isset(self::$phrases[$this->status])) return self::$phrases[$this->status]; return 'NOT_DEFINED'; }
php
public function getReasonPhrase() { if ($this->phrase) return $this->phrase; if (isset(self::$phrases[$this->status])) return self::$phrases[$this->status]; return 'NOT_DEFINED'; }
Gets the response reason phrase associated with the status code. Because a reason phrase is not a required element in a response status line, the reason phrase value MAY be null. Implementations MAY choose to return the default RFC 7231 recommended reason phrase (or those listed in the IANA HTTP Status Code Registry) for the response's status code. @link http://tools.ietf.org/html/rfc7231#section-6 @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml @return string Reason phrase; must return an empty string if none present.
https://github.com/irfantoor/engine/blob/4d2d221add749f75100d0b4ffe1488cdbf7af5d3/src/Http/Response.php#L188-L197
drdplusinfo/drdplus-fight-properties
DrdPlus/FightProperties/FightProperties.php
FightProperties.getStrengthForWeaponOrShield
private function getStrengthForWeaponOrShield(WeaponlikeCode $weaponOrShield, ItemHoldingCode $itemHoldingCode): Strength { return $this->armourer->getStrengthForWeaponOrShield( $weaponOrShield, $itemHoldingCode, $this->bodyPropertiesForFight->getStrengthOfMainHand() ); }
php
private function getStrengthForWeaponOrShield(WeaponlikeCode $weaponOrShield, ItemHoldingCode $itemHoldingCode): Strength { return $this->armourer->getStrengthForWeaponOrShield( $weaponOrShield, $itemHoldingCode, $this->bodyPropertiesForFight->getStrengthOfMainHand() ); }
If one-handed weapon or shield is kept by both hands, the required strength for weapon is lower (fighter strength is considered higher respectively), see details in PPH page 93, left column. @param WeaponlikeCode $weaponOrShield @param ItemHoldingCode $itemHoldingCode @return Strength
https://github.com/drdplusinfo/drdplus-fight-properties/blob/66cfce5fa8ba940ee5b9069c5ce6d5a645d4e1a1/DrdPlus/FightProperties/FightProperties.php#L322-L329
drdplusinfo/drdplus-fight-properties
DrdPlus/FightProperties/FightProperties.php
FightProperties.getShieldHolding
private function getShieldHolding(): ItemHoldingCode { if ($this->weaponlikeHolding->holdsByMainHand()) { return ItemHoldingCode::getIt(ItemHoldingCode::OFFHAND); } if ($this->weaponlikeHolding->holdsByOffhand()) { return ItemHoldingCode::getIt(ItemHoldingCode::MAIN_HAND); } // two hands holding if ($this->shield->getValue() === ShieldCode::WITHOUT_SHIELD) { return ItemHoldingCode::getIt(ItemHoldingCode::MAIN_HAND); } throw new Exceptions\NoHandLeftForShield( "Can not hold {$this->shield} when holding {$this->weaponlike} with {$this->weaponlikeHolding}" ); }
php
private function getShieldHolding(): ItemHoldingCode { if ($this->weaponlikeHolding->holdsByMainHand()) { return ItemHoldingCode::getIt(ItemHoldingCode::OFFHAND); } if ($this->weaponlikeHolding->holdsByOffhand()) { return ItemHoldingCode::getIt(ItemHoldingCode::MAIN_HAND); } // two hands holding if ($this->shield->getValue() === ShieldCode::WITHOUT_SHIELD) { return ItemHoldingCode::getIt(ItemHoldingCode::MAIN_HAND); } throw new Exceptions\NoHandLeftForShield( "Can not hold {$this->shield} when holding {$this->weaponlike} with {$this->weaponlikeHolding}" ); }
Gives holding opposite to given weapon holding. @return ItemHoldingCode @throws \DrdPlus\FightProperties\Exceptions\NoHandLeftForShield
https://github.com/drdplusinfo/drdplus-fight-properties/blob/66cfce5fa8ba940ee5b9069c5ce6d5a645d4e1a1/DrdPlus/FightProperties/FightProperties.php#L346-L361
drdplusinfo/drdplus-fight-properties
DrdPlus/FightProperties/FightProperties.php
FightProperties.getFightNumber
public function getFightNumber(): FightNumber { if ($this->fightNumber === null) { $this->fightNumber = FightNumber::getIt($this->getFight(), $this->getLongerWeaponlike(), $this->tables) ->add($this->getFightNumberModifier()); } return $this->fightNumber; }
php
public function getFightNumber(): FightNumber { if ($this->fightNumber === null) { $this->fightNumber = FightNumber::getIt($this->getFight(), $this->getLongerWeaponlike(), $this->tables) ->add($this->getFightNumberModifier()); } return $this->fightNumber; }
Final fight number including body state (level, fatigue, wounds, curses...), used weapon and chosen action. @return FightNumber
https://github.com/drdplusinfo/drdplus-fight-properties/blob/66cfce5fa8ba940ee5b9069c5ce6d5a645d4e1a1/DrdPlus/FightProperties/FightProperties.php#L385-L393
drdplusinfo/drdplus-fight-properties
DrdPlus/FightProperties/FightProperties.php
FightProperties.getFightNumberModifier
private function getFightNumberModifier(): int { $fightNumberModifier = 0; // strength effect $fightNumberModifier += $this->getFightNumberMalusByStrength(); // skills effect $fightNumberModifier += $this->getFightNumberMalusBySkills(); // combat actions effect $fightNumberModifier += $this->combatActions->getFightNumberModifier(); return $fightNumberModifier; }
php
private function getFightNumberModifier(): int { $fightNumberModifier = 0; // strength effect $fightNumberModifier += $this->getFightNumberMalusByStrength(); // skills effect $fightNumberModifier += $this->getFightNumberMalusBySkills(); // combat actions effect $fightNumberModifier += $this->combatActions->getFightNumberModifier(); return $fightNumberModifier; }
Fight number update according to a missing strength, missing skill and by a combat action @return int
https://github.com/drdplusinfo/drdplus-fight-properties/blob/66cfce5fa8ba940ee5b9069c5ce6d5a645d4e1a1/DrdPlus/FightProperties/FightProperties.php#L400-L414
drdplusinfo/drdplus-fight-properties
DrdPlus/FightProperties/FightProperties.php
FightProperties.getAttackNumber
public function getAttackNumber(Distance $targetDistance, Size $targetSize): AttackNumber { return $this->createBaseAttackNumber()->add($this->getAttackNumberModifier($targetDistance, $targetSize)); }
php
public function getAttackNumber(Distance $targetDistance, Size $targetSize): AttackNumber { return $this->createBaseAttackNumber()->add($this->getAttackNumberModifier($targetDistance, $targetSize)); }
Final attack number including body state (level, fatigue, wounds, curses...), used weapon and action. @param Distance $targetDistance @param Size $targetSize @return AttackNumber
https://github.com/drdplusinfo/drdplus-fight-properties/blob/66cfce5fa8ba940ee5b9069c5ce6d5a645d4e1a1/DrdPlus/FightProperties/FightProperties.php#L530-L533
drdplusinfo/drdplus-fight-properties
DrdPlus/FightProperties/FightProperties.php
FightProperties.getBaseOfWounds
public function getBaseOfWounds(): BaseOfWounds { if ($this->baseOfWounds === null) { $baseOfWoundsValue = 0; // strength and weapon effects $baseOfWoundsValue += $this->armourer->getBaseOfWoundsUsingWeaponlike( $this->weaponlike, $this->getStrengthForWeaponlike() ); // skill effect $baseOfWoundsValue += $this->skills->getMalusToBaseOfWoundsWithWeaponlike( $this->weaponlike, $this->tables, $this->fightsWithTwoWeapons ); // holding effect $baseOfWoundsValue += $this->armourer->getBaseOfWoundsBonusForHolding( $this->weaponlike, $this->weaponlikeHolding ); // action effects $baseOfWoundsValue += $this->combatActions->getBaseOfWoundsModifier( $this->tables->getWeaponlikeTableByWeaponlikeCode($this->weaponlike) ->getWoundsTypeOf($this->weaponlike) === PhysicalWoundTypeCode::CRUSH ); if ($this->fightsFreeWillAnimal) { $baseOfWoundsValue += $this->skills->getBonusToBaseOfWoundsAgainstFreeWillAnimal(); } $this->baseOfWounds = new BaseOfWounds($baseOfWoundsValue, $this->tables->getWoundsTable()); } return $this->baseOfWounds; }
php
public function getBaseOfWounds(): BaseOfWounds { if ($this->baseOfWounds === null) { $baseOfWoundsValue = 0; // strength and weapon effects $baseOfWoundsValue += $this->armourer->getBaseOfWoundsUsingWeaponlike( $this->weaponlike, $this->getStrengthForWeaponlike() ); // skill effect $baseOfWoundsValue += $this->skills->getMalusToBaseOfWoundsWithWeaponlike( $this->weaponlike, $this->tables, $this->fightsWithTwoWeapons ); // holding effect $baseOfWoundsValue += $this->armourer->getBaseOfWoundsBonusForHolding( $this->weaponlike, $this->weaponlikeHolding ); // action effects $baseOfWoundsValue += $this->combatActions->getBaseOfWoundsModifier( $this->tables->getWeaponlikeTableByWeaponlikeCode($this->weaponlike) ->getWoundsTypeOf($this->weaponlike) === PhysicalWoundTypeCode::CRUSH ); if ($this->fightsFreeWillAnimal) { $baseOfWoundsValue += $this->skills->getBonusToBaseOfWoundsAgainstFreeWillAnimal(); } $this->baseOfWounds = new BaseOfWounds($baseOfWoundsValue, $this->tables->getWoundsTable()); } return $this->baseOfWounds; }
Gives @see WoundsBonus - if you need current Wounds just convert WoundsBonus to it by WoundsBonus->getWounds() This number is without actions. @see Wounds Note about both hands holding of a weapon - if you have empty off-hand (without shield) and the weapon you are holding is single-hand, it will automatically add +2 for two-hand holding (if you choose such action). See PPH page 92 right column. @return BaseOfWounds
https://github.com/drdplusinfo/drdplus-fight-properties/blob/66cfce5fa8ba940ee5b9069c5ce6d5a645d4e1a1/DrdPlus/FightProperties/FightProperties.php#L618-L655
drdplusinfo/drdplus-fight-properties
DrdPlus/FightProperties/FightProperties.php
FightProperties.getLoadingInRounds
public function getLoadingInRounds(): LoadingInRounds { if ($this->loadingInRounds === null) { $loadingInRoundsValue = 0; if ($this->weaponlike instanceof RangedWeaponCode) { $loadingInRoundsValue = $this->armourer->getLoadingInRoundsByStrengthWithRangedWeapon( $this->weaponlike, $this->getStrengthForWeaponlike() ); } $this->loadingInRounds = LoadingInRounds::getIt($loadingInRoundsValue); } return $this->loadingInRounds; }
php
public function getLoadingInRounds(): LoadingInRounds { if ($this->loadingInRounds === null) { $loadingInRoundsValue = 0; if ($this->weaponlike instanceof RangedWeaponCode) { $loadingInRoundsValue = $this->armourer->getLoadingInRoundsByStrengthWithRangedWeapon( $this->weaponlike, $this->getStrengthForWeaponlike() ); } $this->loadingInRounds = LoadingInRounds::getIt($loadingInRoundsValue); } return $this->loadingInRounds; }
Note: for melee weapons the loading is zero. @return LoadingInRounds
https://github.com/drdplusinfo/drdplus-fight-properties/blob/66cfce5fa8ba940ee5b9069c5ce6d5a645d4e1a1/DrdPlus/FightProperties/FightProperties.php#L662-L677
drdplusinfo/drdplus-fight-properties
DrdPlus/FightProperties/FightProperties.php
FightProperties.getEncounterRange
public function getEncounterRange(): EncounterRange { if ($this->encounterRange === null) { $this->encounterRange = EncounterRange::getIt( $this->armourer->getEncounterRangeWithWeaponlike( $this->weaponlike, $this->getStrengthForWeaponlike(), $this->bodyPropertiesForFight->getSpeed() ) ); } return $this->encounterRange; }
php
public function getEncounterRange(): EncounterRange { if ($this->encounterRange === null) { $this->encounterRange = EncounterRange::getIt( $this->armourer->getEncounterRangeWithWeaponlike( $this->weaponlike, $this->getStrengthForWeaponlike(), $this->bodyPropertiesForFight->getSpeed() ) ); } return $this->encounterRange; }
Encounter range relates to weapon and strength for bows, speed for throwing weapons and nothing else for crossbows. See PPH page 95 left column. Melee weapons have encounter range zero. Note about SPEAR: if current weapon for attack is spear for melee @see MeleeWeaponCode::SPEAR then range is zero. @return EncounterRange
https://github.com/drdplusinfo/drdplus-fight-properties/blob/66cfce5fa8ba940ee5b9069c5ce6d5a645d4e1a1/DrdPlus/FightProperties/FightProperties.php#L687-L700
drdplusinfo/drdplus-fight-properties
DrdPlus/FightProperties/FightProperties.php
FightProperties.getMaximalRange
public function getMaximalRange(): MaximalRange { if ($this->maximalRange === null) { if ($this->weaponlike instanceof RangedWeaponCode) { $this->maximalRange = MaximalRange::getItForRangedWeapon($this->getEncounterRange()); } else { $this->maximalRange = MaximalRange::getItForMeleeWeapon($this->getEncounterRange()); // encounter = maximal for melee weapons } } return $this->maximalRange; }
php
public function getMaximalRange(): MaximalRange { if ($this->maximalRange === null) { if ($this->weaponlike instanceof RangedWeaponCode) { $this->maximalRange = MaximalRange::getItForRangedWeapon($this->getEncounterRange()); } else { $this->maximalRange = MaximalRange::getItForMeleeWeapon($this->getEncounterRange()); // encounter = maximal for melee weapons } } return $this->maximalRange; }
Ranged weapons can be used for indirect shooting and those have much longer maximal and still somehow controllable (more or less - depends on weapon) range. Others have their maximal (and still controllable) range same as encounter range. See PPH page 104 left column. @return MaximalRange
https://github.com/drdplusinfo/drdplus-fight-properties/blob/66cfce5fa8ba940ee5b9069c5ce6d5a645d4e1a1/DrdPlus/FightProperties/FightProperties.php#L710-L721
drdplusinfo/drdplus-fight-properties
DrdPlus/FightProperties/FightProperties.php
FightProperties.getDefenseNumber
public function getDefenseNumber(): DefenseNumber { if ($this->defenseNumber === null) { $baseDefenseNumber = DefenseNumber::getIt($this->getDefense()); if ($this->enemyIsFasterThanYou) { // You CAN be affected by some of your actions because someone attacked you before you finished them. // Your defense WITHOUT weapon and shield. $defenseNumber = $baseDefenseNumber ->add($this->combatActions->getDefenseNumberModifierAgainstFasterOpponent()); } else { // You are NOT affected by any of your action just because someone attacked you before you are ready. $defenseNumber = $baseDefenseNumber ->add($this->combatActions->getDefenseNumberModifier()); } if (!$this->combatActions->usesSimplifiedLightingRules() && $this->glared->getCurrentMalus() < 0) { // see PPH page 129 top left $defenseNumber = $defenseNumber->add($this->glared->getCurrentMalus()); } // ride skill if ($this->fightsOnHorseback) { $defenseNumber = $defenseNumber->add($this->skills->getMalusToAttackNumberWhenRiding()); } $this->defenseNumber = $defenseNumber; } return $this->defenseNumber; }
php
public function getDefenseNumber(): DefenseNumber { if ($this->defenseNumber === null) { $baseDefenseNumber = DefenseNumber::getIt($this->getDefense()); if ($this->enemyIsFasterThanYou) { // You CAN be affected by some of your actions because someone attacked you before you finished them. // Your defense WITHOUT weapon and shield. $defenseNumber = $baseDefenseNumber ->add($this->combatActions->getDefenseNumberModifierAgainstFasterOpponent()); } else { // You are NOT affected by any of your action just because someone attacked you before you are ready. $defenseNumber = $baseDefenseNumber ->add($this->combatActions->getDefenseNumberModifier()); } if (!$this->combatActions->usesSimplifiedLightingRules() && $this->glared->getCurrentMalus() < 0) { // see PPH page 129 top left $defenseNumber = $defenseNumber->add($this->glared->getCurrentMalus()); } // ride skill if ($this->fightsOnHorseback) { $defenseNumber = $defenseNumber->add($this->skills->getMalusToAttackNumberWhenRiding()); } $this->defenseNumber = $defenseNumber; } return $this->defenseNumber; }
Your defense WITHOUT weapon and shield. For standard defense @see getDefenseNumberWithShield and @see getDefenseNumberWithWeaponlike Note: armor affects agility (can give restriction), but does NOT change defense number directly - its protection is used after hit to lower final damage. @return DefenseNumber
https://github.com/drdplusinfo/drdplus-fight-properties/blob/66cfce5fa8ba940ee5b9069c5ce6d5a645d4e1a1/DrdPlus/FightProperties/FightProperties.php#L745-L773
drdplusinfo/drdplus-fight-properties
DrdPlus/FightProperties/FightProperties.php
FightProperties.getDefenseNumberWithShield
public function getDefenseNumberWithShield(): DefenseNumber { if ($this->defenseNumberWithShield === null) { $this->defenseNumberWithShield = $this->getDefenseNumber()->add($this->getCoverWithShield()); } return $this->defenseNumberWithShield; }
php
public function getDefenseNumberWithShield(): DefenseNumber { if ($this->defenseNumberWithShield === null) { $this->defenseNumberWithShield = $this->getDefenseNumber()->add($this->getCoverWithShield()); } return $this->defenseNumberWithShield; }
You have to choose - if cover by shield (can twice per round even if already attacked) - or by weapon (can only once per round and only if you have attacked before defense or if you simply did not used this weapon yet) - or just by a dodge (in that case use the pure @see getDefenseNumber ). Note about offhand - even shield is affected by lower strength of your offhand lower strength (-2). @return DefenseNumber
https://github.com/drdplusinfo/drdplus-fight-properties/blob/66cfce5fa8ba940ee5b9069c5ce6d5a645d4e1a1/DrdPlus/FightProperties/FightProperties.php#L832-L839
drdplusinfo/drdplus-fight-properties
DrdPlus/FightProperties/FightProperties.php
FightProperties.getMovedDistance
public function getMovedDistance(): Distance { if ($this->movedDistance === null) { if ($this->combatActions->getSpeedModifier() === 0) { $this->movedDistance = new Distance(0, DistanceUnitCode::METER, $this->tables->getDistanceTable()); } else { $speedInFight = $this->bodyPropertiesForFight->getSpeed()->add($this->combatActions->getSpeedModifier()); $distanceBonus = new DistanceBonus($speedInFight->getValue(), $this->tables->getDistanceTable()); $this->movedDistance = $distanceBonus->getDistance(); } } return $this->movedDistance; }
php
public function getMovedDistance(): Distance { if ($this->movedDistance === null) { if ($this->combatActions->getSpeedModifier() === 0) { $this->movedDistance = new Distance(0, DistanceUnitCode::METER, $this->tables->getDistanceTable()); } else { $speedInFight = $this->bodyPropertiesForFight->getSpeed()->add($this->combatActions->getSpeedModifier()); $distanceBonus = new DistanceBonus($speedInFight->getValue(), $this->tables->getDistanceTable()); $this->movedDistance = $distanceBonus->getDistance(); } } return $this->movedDistance; }
Note: without chosen movement action you are not moving at all, therefore moved distance is zero. @return Distance
https://github.com/drdplusinfo/drdplus-fight-properties/blob/66cfce5fa8ba940ee5b9069c5ce6d5a645d4e1a1/DrdPlus/FightProperties/FightProperties.php#L873-L887
bearsunday/BEAR.ReactJsModule
src/ReduxModule.php
ReduxModule.configure
protected function configure() { $this->bind()->annotatedWith('react_bundle_src')->toInstance($this->reactBundleSrc); $this->bind()->annotatedWith('app_bundle_src_' . $this->name)->toInstance($this->appBundleSrc); $this->bind()->annotatedWith('redux_app_name_' . $this->name)->toInstance($this->name); $reduxReactJsname = "reactBundleSrc=react_bundle_src,appBundleSrc=app_bundle_src_{$this->name}"; $this->bind(ReduxReactJsInterface::class)->annotatedWith($this->name)->toConstructor(ReduxReactJs::class, $reduxReactJsname); $reduxRendererName = "appName=redux_app_name_{$this->name},redux={$this->name}"; $this->bind(RenderInterface::class)->annotatedWith($this->name)->toConstructor(ReduxRenderer::class, $reduxRendererName); $this->bind(ExceptionHandlerInterface::class)->to(ExceptionHandler::class); $this->bind(\V8Js::class)->toConstructor(\V8Js::class, 'object_name=v8js_object_name,variables=v8js_variables,extensions=v8js_extensions,snapshot_blob=v8js_snapshot_blob'); $this->bind()->annotatedWith('v8js_object_name')->toInstance(''); $this->bind()->annotatedWith('v8js_variables')->toInstance([]); $this->bind()->annotatedWith('v8js_extensions')->toInstance([]); $this->bind()->annotatedWith('v8js_snapshot_blob')->toInstance(''); }
php
protected function configure() { $this->bind()->annotatedWith('react_bundle_src')->toInstance($this->reactBundleSrc); $this->bind()->annotatedWith('app_bundle_src_' . $this->name)->toInstance($this->appBundleSrc); $this->bind()->annotatedWith('redux_app_name_' . $this->name)->toInstance($this->name); $reduxReactJsname = "reactBundleSrc=react_bundle_src,appBundleSrc=app_bundle_src_{$this->name}"; $this->bind(ReduxReactJsInterface::class)->annotatedWith($this->name)->toConstructor(ReduxReactJs::class, $reduxReactJsname); $reduxRendererName = "appName=redux_app_name_{$this->name},redux={$this->name}"; $this->bind(RenderInterface::class)->annotatedWith($this->name)->toConstructor(ReduxRenderer::class, $reduxRendererName); $this->bind(ExceptionHandlerInterface::class)->to(ExceptionHandler::class); $this->bind(\V8Js::class)->toConstructor(\V8Js::class, 'object_name=v8js_object_name,variables=v8js_variables,extensions=v8js_extensions,snapshot_blob=v8js_snapshot_blob'); $this->bind()->annotatedWith('v8js_object_name')->toInstance(''); $this->bind()->annotatedWith('v8js_variables')->toInstance([]); $this->bind()->annotatedWith('v8js_extensions')->toInstance([]); $this->bind()->annotatedWith('v8js_snapshot_blob')->toInstance(''); }
{@inheritdoc}
https://github.com/bearsunday/BEAR.ReactJsModule/blob/ccac3639b811a00373b75ca46e461bb27928e86d/src/ReduxModule.php#L49-L64
niridoy/LaraveIinstaller
src/Helpers/FinalInstallManager.php
FinalInstallManager.generateKey
private static function generateKey($outputLog) { try{ Artisan::call('key:generate', ["--force"=> true], $outputLog); } catch(Exception $e){ return $this->response($e->getMessage()); } return $outputLog; }
php
private static function generateKey($outputLog) { try{ Artisan::call('key:generate', ["--force"=> true], $outputLog); } catch(Exception $e){ return $this->response($e->getMessage()); } return $outputLog; }
Generate New Application Key. @param collection $outputLog @return collection
https://github.com/niridoy/LaraveIinstaller/blob/8339cf45bf393be57fb4e6c63179a6865028f076/src/Helpers/FinalInstallManager.php#L32-L42
Wedeto/DB
src/Query/FieldName.php
FieldName.toSQL
public function toSQL(Parameters $params, bool $inner_clause) { $field = $this->getField(); $table = $this->getTable(); if (empty($table)) $table = $params->getDefaultTable(); $drv = $params->getDriver(); if (!empty($table)) { list($table, $alias) = $params->resolveTable($table->getPrefix()); if ($alias) $table_ref = $drv->identQuote($alias); else $table_ref = $drv->getName($table); return $table_ref . '.' . $drv->identQuote($field); } return $drv->identQuote($field); }
php
public function toSQL(Parameters $params, bool $inner_clause) { $field = $this->getField(); $table = $this->getTable(); if (empty($table)) $table = $params->getDefaultTable(); $drv = $params->getDriver(); if (!empty($table)) { list($table, $alias) = $params->resolveTable($table->getPrefix()); if ($alias) $table_ref = $drv->identQuote($alias); else $table_ref = $drv->getName($table); return $table_ref . '.' . $drv->identQuote($field); } return $drv->identQuote($field); }
Write a field name as SQL query syntax @param Parameters $params The query parameters: tables and placeholder values @param bool $inner_clause Unused @return string The generated SQL
https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/FieldName.php#L58-L78
wobblecode/WobbleCodeUserBundle
Manager/OrganizationManager.php
OrganizationManager.setupOrganization
public function setupOrganization(User $user) { $guestCreateOrganization = false; $invitationHash = $this->session->get('newInvitation', false); if ($guestCreateOrganization || $invitationHash == false) { $organization = $this->createOrganization($user); } if ($invitationHash) { $organization = $this->processInvitationByHash($user, $invitationHash); } return $organization; }
php
public function setupOrganization(User $user) { $guestCreateOrganization = false; $invitationHash = $this->session->get('newInvitation', false); if ($guestCreateOrganization || $invitationHash == false) { $organization = $this->createOrganization($user); } if ($invitationHash) { $organization = $this->processInvitationByHash($user, $invitationHash); } return $organization; }
Setup organization from signup. It chekcs if there is an invitationHash in session @todo Add Bundle option for $guestCreateOrganization @param User $user @return Organization
https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/OrganizationManager.php#L66-L80
wobblecode/WobbleCodeUserBundle
Manager/OrganizationManager.php
OrganizationManager.createOrganization
public function createOrganization(User $user) { $organization = new $this->organizationClass; $organization->setOwner($user); $organization->addUser($user); $role = new Role; $role->setRoles(array('ROLE_ORGANIZATION_OWNER')); $role->setUser($user); $role->setOrganization($organization); $contact = $user->getContact(); if (!$contact) { $contact = new Contact; $user->setContact($contact); } $organizationContact = clone $user->getContact(); $organization->setContact($organizationContact); $user->setActiveOrganization($organization); $user->setActiveRole($role); $this->dm->persist($user); $this->dm->persist($role); $this->dm->persist($contact); $this->dm->persist($organizationContact); $this->dm->persist($organization); $this->dm->flush(); $this->eventDispatcher->dispatch( 'wc_user.organization.create', new GenericEvent('wc_user.organization.create', array( 'notifyUser' => $user, 'notifyOrganizationTrigger' => $organization, 'notifyOrganizations' => [$organization], 'data' => [ 'organization' => $organization ] )) ); return $organization; }
php
public function createOrganization(User $user) { $organization = new $this->organizationClass; $organization->setOwner($user); $organization->addUser($user); $role = new Role; $role->setRoles(array('ROLE_ORGANIZATION_OWNER')); $role->setUser($user); $role->setOrganization($organization); $contact = $user->getContact(); if (!$contact) { $contact = new Contact; $user->setContact($contact); } $organizationContact = clone $user->getContact(); $organization->setContact($organizationContact); $user->setActiveOrganization($organization); $user->setActiveRole($role); $this->dm->persist($user); $this->dm->persist($role); $this->dm->persist($contact); $this->dm->persist($organizationContact); $this->dm->persist($organization); $this->dm->flush(); $this->eventDispatcher->dispatch( 'wc_user.organization.create', new GenericEvent('wc_user.organization.create', array( 'notifyUser' => $user, 'notifyOrganizationTrigger' => $organization, 'notifyOrganizations' => [$organization], 'data' => [ 'organization' => $organization ] )) ); return $organization; }
It creates and completes a new Organization @param OrganizationInterface $organization New empty organization @param User $user User that owns the organizartion @return Organization The new organization
https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/OrganizationManager.php#L90-L133
wobblecode/WobbleCodeUserBundle
Manager/OrganizationManager.php
OrganizationManager.addMember
public function addMember(OrganizationInterface $organization, User $user, array $roles) { if ($organization->getOwner() === null) { $organization->setOwner($user); } $user->addOrganization($organization); $organization->addUser($user); $role = new Role(); $role->setOrganization($organization); $role->setUser($user); $role->setRoles($roles); $this->dm->persist($user); $this->dm->persist($organization); $this->dm->persist($role); $this->dm->flush(); }
php
public function addMember(OrganizationInterface $organization, User $user, array $roles) { if ($organization->getOwner() === null) { $organization->setOwner($user); } $user->addOrganization($organization); $organization->addUser($user); $role = new Role(); $role->setOrganization($organization); $role->setUser($user); $role->setRoles($roles); $this->dm->persist($user); $this->dm->persist($organization); $this->dm->persist($role); $this->dm->flush(); }
Add member to an organization with specifics roles @param OrganizationInterface $organization @param User $user @param array $roles
https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/OrganizationManager.php#L142-L160
wobblecode/WobbleCodeUserBundle
Manager/OrganizationManager.php
OrganizationManager.processInvitationByHash
public function processInvitationByHash(User $user, $hash) { $invitation = $this->dm->getRepository('WobbleCodeUserBundle:Invitation')->findOneBy( [ 'hash' => $hash, 'status' => 'pending' ] ); if (!$invitation) { return false; } $organization = $invitation->getOrganization(); $this->addMemberByInvitation($organization, $user, $invitation); return $organization; }
php
public function processInvitationByHash(User $user, $hash) { $invitation = $this->dm->getRepository('WobbleCodeUserBundle:Invitation')->findOneBy( [ 'hash' => $hash, 'status' => 'pending' ] ); if (!$invitation) { return false; } $organization = $invitation->getOrganization(); $this->addMemberByInvitation($organization, $user, $invitation); return $organization; }
Finds an Invitation by Hash and add member if exists @param User $user @param string $hash Secret Invitation Hash
https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/OrganizationManager.php#L168-L185
wobblecode/WobbleCodeUserBundle
Manager/OrganizationManager.php
OrganizationManager.addMemberByInvitation
public function addMemberByInvitation(OrganizationInterface $organization, User $user, Invitation $invitation) { $this->addMember($organization, $user, $invitation->getRoles()); $invitation->setStatus('accepted'); $invitation->setTo($user); $this->dm->persist($invitation); $this->dm->flush(); }
php
public function addMemberByInvitation(OrganizationInterface $organization, User $user, Invitation $invitation) { $this->addMember($organization, $user, $invitation->getRoles()); $invitation->setStatus('accepted'); $invitation->setTo($user); $this->dm->persist($invitation); $this->dm->flush(); }
Add member to an Organization using settings from invitation @param OrganizationInterface $organization @param User $user @param Invitation $invitation
https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/OrganizationManager.php#L194-L202
wobblecode/WobbleCodeUserBundle
Manager/OrganizationManager.php
OrganizationManager.getAdminOwner
public function getAdminOwner() { $repo = $this->dm->getRepository($this->organizationClass); return $repo->findOneBy([ 'adminOwner' => true ]); }
php
public function getAdminOwner() { $repo = $this->dm->getRepository($this->organizationClass); return $repo->findOneBy([ 'adminOwner' => true ]); }
Gets the system admin Organization @return OrganizationInterface
https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/OrganizationManager.php#L209-L216
agentmedia/phine-core
src/Core/Logic/Rendering/ContentRenderer.php
ContentRenderer.Render
function Render() { if (!self::Guard()->Allow(Action::Read(), $this->content)) { return ''; } ContentTranslator::Singleton()->SetContent($this->content); $module = ClassFinder::CreateFrontendModule($this->content->GetType()); $module->SetTreeItem($this->tree, $this->item); return $module->Render(); }
php
function Render() { if (!self::Guard()->Allow(Action::Read(), $this->content)) { return ''; } ContentTranslator::Singleton()->SetContent($this->content); $module = ClassFinder::CreateFrontendModule($this->content->GetType()); $module->SetTreeItem($this->tree, $this->item); return $module->Render(); }
Renders the content @return string Returns the rendered content
https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Rendering/ContentRenderer.php#L67-L77
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.getTimestamp
public function getTimestamp($format = NULL) { if ($format === null) { return $this->timestamp; } else { return $this->timestamp instanceof \DateTimeInterface ? $this->timestamp->format($format) : null; } }
php
public function getTimestamp($format = NULL) { if ($format === null) { return $this->timestamp; } else { return $this->timestamp instanceof \DateTimeInterface ? $this->timestamp->format($format) : null; } }
Get the [optionally formatted] temporal [timestamp] column value. @param string $format The date/time format string (either date()-style or strftime()-style). If format is NULL, then the raw DateTime object will be returned. @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL @throws PropelException - if unable to parse/validate the date/time value.
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L811-L818
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setSourceId
public function setSourceId($v) { if ($v !== null) { $v = (int) $v; } if ($this->source_id !== $v) { $this->source_id = $v; $this->modifiedColumns[MediaTableMap::COL_SOURCE_ID] = true; } if ($this->aSource !== null && $this->aSource->getId() !== $v) { $this->aSource = null; } return $this; }
php
public function setSourceId($v) { if ($v !== null) { $v = (int) $v; } if ($this->source_id !== $v) { $this->source_id = $v; $this->modifiedColumns[MediaTableMap::COL_SOURCE_ID] = true; } if ($this->aSource !== null && $this->aSource->getId() !== $v) { $this->aSource = null; } return $this; }
Set the value of [source_id] column. @param int $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L956-L972
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setPageid
public function setPageid($v) { if ($v !== null) { $v = (int) $v; } if ($this->pageid !== $v) { $this->pageid = $v; $this->modifiedColumns[MediaTableMap::COL_PAGEID] = true; } return $this; }
php
public function setPageid($v) { if ($v !== null) { $v = (int) $v; } if ($this->pageid !== $v) { $this->pageid = $v; $this->modifiedColumns[MediaTableMap::COL_PAGEID] = true; } return $this; }
Set the value of [pageid] column. @param int $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L980-L992
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setMime
public function setMime($v) { if ($v !== null) { $v = (string) $v; } if ($this->mime !== $v) { $this->mime = $v; $this->modifiedColumns[MediaTableMap::COL_MIME] = true; } return $this; }
php
public function setMime($v) { if ($v !== null) { $v = (string) $v; } if ($this->mime !== $v) { $this->mime = $v; $this->modifiedColumns[MediaTableMap::COL_MIME] = true; } return $this; }
Set the value of [mime] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1040-L1052
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setWidth
public function setWidth($v) { if ($v !== null) { $v = (int) $v; } if ($this->width !== $v) { $this->width = $v; $this->modifiedColumns[MediaTableMap::COL_WIDTH] = true; } return $this; }
php
public function setWidth($v) { if ($v !== null) { $v = (int) $v; } if ($this->width !== $v) { $this->width = $v; $this->modifiedColumns[MediaTableMap::COL_WIDTH] = true; } return $this; }
Set the value of [width] column. @param int $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1060-L1072
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setHeight
public function setHeight($v) { if ($v !== null) { $v = (int) $v; } if ($this->height !== $v) { $this->height = $v; $this->modifiedColumns[MediaTableMap::COL_HEIGHT] = true; } return $this; }
php
public function setHeight($v) { if ($v !== null) { $v = (int) $v; } if ($this->height !== $v) { $this->height = $v; $this->modifiedColumns[MediaTableMap::COL_HEIGHT] = true; } return $this; }
Set the value of [height] column. @param int $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1080-L1092
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setSha1
public function setSha1($v) { if ($v !== null) { $v = (string) $v; } if ($this->sha1 !== $v) { $this->sha1 = $v; $this->modifiedColumns[MediaTableMap::COL_SHA1] = true; } return $this; }
php
public function setSha1($v) { if ($v !== null) { $v = (string) $v; } if ($this->sha1 !== $v) { $this->sha1 = $v; $this->modifiedColumns[MediaTableMap::COL_SHA1] = true; } return $this; }
Set the value of [sha1] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1120-L1132
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setThumburl
public function setThumburl($v) { if ($v !== null) { $v = (string) $v; } if ($this->thumburl !== $v) { $this->thumburl = $v; $this->modifiedColumns[MediaTableMap::COL_THUMBURL] = true; } return $this; }
php
public function setThumburl($v) { if ($v !== null) { $v = (string) $v; } if ($this->thumburl !== $v) { $this->thumburl = $v; $this->modifiedColumns[MediaTableMap::COL_THUMBURL] = true; } return $this; }
Set the value of [thumburl] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1140-L1152
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setThumbmime
public function setThumbmime($v) { if ($v !== null) { $v = (string) $v; } if ($this->thumbmime !== $v) { $this->thumbmime = $v; $this->modifiedColumns[MediaTableMap::COL_THUMBMIME] = true; } return $this; }
php
public function setThumbmime($v) { if ($v !== null) { $v = (string) $v; } if ($this->thumbmime !== $v) { $this->thumbmime = $v; $this->modifiedColumns[MediaTableMap::COL_THUMBMIME] = true; } return $this; }
Set the value of [thumbmime] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1160-L1172
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setThumbwidth
public function setThumbwidth($v) { if ($v !== null) { $v = (int) $v; } if ($this->thumbwidth !== $v) { $this->thumbwidth = $v; $this->modifiedColumns[MediaTableMap::COL_THUMBWIDTH] = true; } return $this; }
php
public function setThumbwidth($v) { if ($v !== null) { $v = (int) $v; } if ($this->thumbwidth !== $v) { $this->thumbwidth = $v; $this->modifiedColumns[MediaTableMap::COL_THUMBWIDTH] = true; } return $this; }
Set the value of [thumbwidth] column. @param int $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1180-L1192
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setThumbheight
public function setThumbheight($v) { if ($v !== null) { $v = (int) $v; } if ($this->thumbheight !== $v) { $this->thumbheight = $v; $this->modifiedColumns[MediaTableMap::COL_THUMBHEIGHT] = true; } return $this; }
php
public function setThumbheight($v) { if ($v !== null) { $v = (int) $v; } if ($this->thumbheight !== $v) { $this->thumbheight = $v; $this->modifiedColumns[MediaTableMap::COL_THUMBHEIGHT] = true; } return $this; }
Set the value of [thumbheight] column. @param int $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1200-L1212
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setThumbsize
public function setThumbsize($v) { if ($v !== null) { $v = (int) $v; } if ($this->thumbsize !== $v) { $this->thumbsize = $v; $this->modifiedColumns[MediaTableMap::COL_THUMBSIZE] = true; } return $this; }
php
public function setThumbsize($v) { if ($v !== null) { $v = (int) $v; } if ($this->thumbsize !== $v) { $this->thumbsize = $v; $this->modifiedColumns[MediaTableMap::COL_THUMBSIZE] = true; } return $this; }
Set the value of [thumbsize] column. @param int $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1220-L1232
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setDescriptionurl
public function setDescriptionurl($v) { if ($v !== null) { $v = (string) $v; } if ($this->descriptionurl !== $v) { $this->descriptionurl = $v; $this->modifiedColumns[MediaTableMap::COL_DESCRIPTIONURL] = true; } return $this; }
php
public function setDescriptionurl($v) { if ($v !== null) { $v = (string) $v; } if ($this->descriptionurl !== $v) { $this->descriptionurl = $v; $this->modifiedColumns[MediaTableMap::COL_DESCRIPTIONURL] = true; } return $this; }
Set the value of [descriptionurl] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1240-L1252
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setDescriptionurlshort
public function setDescriptionurlshort($v) { if ($v !== null) { $v = (string) $v; } if ($this->descriptionurlshort !== $v) { $this->descriptionurlshort = $v; $this->modifiedColumns[MediaTableMap::COL_DESCRIPTIONURLSHORT] = true; } return $this; }
php
public function setDescriptionurlshort($v) { if ($v !== null) { $v = (string) $v; } if ($this->descriptionurlshort !== $v) { $this->descriptionurlshort = $v; $this->modifiedColumns[MediaTableMap::COL_DESCRIPTIONURLSHORT] = true; } return $this; }
Set the value of [descriptionurlshort] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1260-L1272
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setImagedescription
public function setImagedescription($v) { if ($v !== null) { $v = (string) $v; } if ($this->imagedescription !== $v) { $this->imagedescription = $v; $this->modifiedColumns[MediaTableMap::COL_IMAGEDESCRIPTION] = true; } return $this; }
php
public function setImagedescription($v) { if ($v !== null) { $v = (string) $v; } if ($this->imagedescription !== $v) { $this->imagedescription = $v; $this->modifiedColumns[MediaTableMap::COL_IMAGEDESCRIPTION] = true; } return $this; }
Set the value of [imagedescription] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1280-L1292
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setDatetimeoriginal
public function setDatetimeoriginal($v) { if ($v !== null) { $v = (string) $v; } if ($this->datetimeoriginal !== $v) { $this->datetimeoriginal = $v; $this->modifiedColumns[MediaTableMap::COL_DATETIMEORIGINAL] = true; } return $this; }
php
public function setDatetimeoriginal($v) { if ($v !== null) { $v = (string) $v; } if ($this->datetimeoriginal !== $v) { $this->datetimeoriginal = $v; $this->modifiedColumns[MediaTableMap::COL_DATETIMEORIGINAL] = true; } return $this; }
Set the value of [datetimeoriginal] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1300-L1312
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setArtist
public function setArtist($v) { if ($v !== null) { $v = (string) $v; } if ($this->artist !== $v) { $this->artist = $v; $this->modifiedColumns[MediaTableMap::COL_ARTIST] = true; } return $this; }
php
public function setArtist($v) { if ($v !== null) { $v = (string) $v; } if ($this->artist !== $v) { $this->artist = $v; $this->modifiedColumns[MediaTableMap::COL_ARTIST] = true; } return $this; }
Set the value of [artist] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1320-L1332
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setLicenseshortname
public function setLicenseshortname($v) { if ($v !== null) { $v = (string) $v; } if ($this->licenseshortname !== $v) { $this->licenseshortname = $v; $this->modifiedColumns[MediaTableMap::COL_LICENSESHORTNAME] = true; } return $this; }
php
public function setLicenseshortname($v) { if ($v !== null) { $v = (string) $v; } if ($this->licenseshortname !== $v) { $this->licenseshortname = $v; $this->modifiedColumns[MediaTableMap::COL_LICENSESHORTNAME] = true; } return $this; }
Set the value of [licenseshortname] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1340-L1352
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setUsageterms
public function setUsageterms($v) { if ($v !== null) { $v = (string) $v; } if ($this->usageterms !== $v) { $this->usageterms = $v; $this->modifiedColumns[MediaTableMap::COL_USAGETERMS] = true; } return $this; }
php
public function setUsageterms($v) { if ($v !== null) { $v = (string) $v; } if ($this->usageterms !== $v) { $this->usageterms = $v; $this->modifiedColumns[MediaTableMap::COL_USAGETERMS] = true; } return $this; }
Set the value of [usageterms] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1360-L1372
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setAttributionrequired
public function setAttributionrequired($v) { if ($v !== null) { $v = (string) $v; } if ($this->attributionrequired !== $v) { $this->attributionrequired = $v; $this->modifiedColumns[MediaTableMap::COL_ATTRIBUTIONREQUIRED] = true; } return $this; }
php
public function setAttributionrequired($v) { if ($v !== null) { $v = (string) $v; } if ($this->attributionrequired !== $v) { $this->attributionrequired = $v; $this->modifiedColumns[MediaTableMap::COL_ATTRIBUTIONREQUIRED] = true; } return $this; }
Set the value of [attributionrequired] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1380-L1392
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setRestrictions
public function setRestrictions($v) { if ($v !== null) { $v = (string) $v; } if ($this->restrictions !== $v) { $this->restrictions = $v; $this->modifiedColumns[MediaTableMap::COL_RESTRICTIONS] = true; } return $this; }
php
public function setRestrictions($v) { if ($v !== null) { $v = (string) $v; } if ($this->restrictions !== $v) { $this->restrictions = $v; $this->modifiedColumns[MediaTableMap::COL_RESTRICTIONS] = true; } return $this; }
Set the value of [restrictions] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1400-L1412
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setTimestamp
public function setTimestamp($v) { $dt = PropelDateTime::newInstance($v, null, 'DateTime'); if ($this->timestamp !== null || $dt !== null) { if ($this->timestamp === null || $dt === null || $dt->format("Y-m-d H:i:s.u") !== $this->timestamp->format("Y-m-d H:i:s.u")) { $this->timestamp = $dt === null ? null : clone $dt; $this->modifiedColumns[MediaTableMap::COL_TIMESTAMP] = true; } } // if either are not null return $this; }
php
public function setTimestamp($v) { $dt = PropelDateTime::newInstance($v, null, 'DateTime'); if ($this->timestamp !== null || $dt !== null) { if ($this->timestamp === null || $dt === null || $dt->format("Y-m-d H:i:s.u") !== $this->timestamp->format("Y-m-d H:i:s.u")) { $this->timestamp = $dt === null ? null : clone $dt; $this->modifiedColumns[MediaTableMap::COL_TIMESTAMP] = true; } } // if either are not null return $this; }
Sets the value of [timestamp] column to a normalized version of the date/time value specified. @param mixed $v string, integer (timestamp), or \DateTimeInterface value. Empty strings are treated as NULL. @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1421-L1432
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setUser
public function setUser($v) { if ($v !== null) { $v = (string) $v; } if ($this->user !== $v) { $this->user = $v; $this->modifiedColumns[MediaTableMap::COL_USER] = true; } return $this; }
php
public function setUser($v) { if ($v !== null) { $v = (string) $v; } if ($this->user !== $v) { $this->user = $v; $this->modifiedColumns[MediaTableMap::COL_USER] = true; } return $this; }
Set the value of [user] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1440-L1452
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setUserid
public function setUserid($v) { if ($v !== null) { $v = (int) $v; } if ($this->userid !== $v) { $this->userid = $v; $this->modifiedColumns[MediaTableMap::COL_USERID] = true; } return $this; }
php
public function setUserid($v) { if ($v !== null) { $v = (int) $v; } if ($this->userid !== $v) { $this->userid = $v; $this->modifiedColumns[MediaTableMap::COL_USERID] = true; } return $this; }
Set the value of [userid] column. @param int $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1460-L1472
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setMissing
public function setMissing($v) { if ($v !== null) { if (is_string($v)) { $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; } else { $v = (boolean) $v; } } if ($this->missing !== $v) { $this->missing = $v; $this->modifiedColumns[MediaTableMap::COL_MISSING] = true; } return $this; }
php
public function setMissing($v) { if ($v !== null) { if (is_string($v)) { $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; } else { $v = (boolean) $v; } } if ($this->missing !== $v) { $this->missing = $v; $this->modifiedColumns[MediaTableMap::COL_MISSING] = true; } return $this; }
Sets the value of the [missing] column. Non-boolean arguments are converted using the following rules: * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * 0, '0', 'false', 'off', and 'no' are converted to boolean false Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). @param boolean|integer|string $v The new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1484-L1500
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setKnown
public function setKnown($v) { if ($v !== null) { if (is_string($v)) { $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; } else { $v = (boolean) $v; } } if ($this->known !== $v) { $this->known = $v; $this->modifiedColumns[MediaTableMap::COL_KNOWN] = true; } return $this; }
php
public function setKnown($v) { if ($v !== null) { if (is_string($v)) { $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; } else { $v = (boolean) $v; } } if ($this->known !== $v) { $this->known = $v; $this->modifiedColumns[MediaTableMap::COL_KNOWN] = true; } return $this; }
Sets the value of the [known] column. Non-boolean arguments are converted using the following rules: * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * 0, '0', 'false', 'off', and 'no' are converted to boolean false Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). @param boolean|integer|string $v The new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1512-L1528
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setImagerepository
public function setImagerepository($v) { if ($v !== null) { $v = (string) $v; } if ($this->imagerepository !== $v) { $this->imagerepository = $v; $this->modifiedColumns[MediaTableMap::COL_IMAGEREPOSITORY] = true; } return $this; }
php
public function setImagerepository($v) { if ($v !== null) { $v = (string) $v; } if ($this->imagerepository !== $v) { $this->imagerepository = $v; $this->modifiedColumns[MediaTableMap::COL_IMAGEREPOSITORY] = true; } return $this; }
Set the value of [imagerepository] column. @param string $v new value @return $this|\Attogram\SharedMedia\Orm\Media The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1536-L1548
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.hydrate
public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) { try { $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : MediaTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : MediaTableMap::translateFieldName('SourceId', TableMap::TYPE_PHPNAME, $indexType)]; $this->source_id = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : MediaTableMap::translateFieldName('Pageid', TableMap::TYPE_PHPNAME, $indexType)]; $this->pageid = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MediaTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; $this->title = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MediaTableMap::translateFieldName('Url', TableMap::TYPE_PHPNAME, $indexType)]; $this->url = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MediaTableMap::translateFieldName('Mime', TableMap::TYPE_PHPNAME, $indexType)]; $this->mime = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : MediaTableMap::translateFieldName('Width', TableMap::TYPE_PHPNAME, $indexType)]; $this->width = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : MediaTableMap::translateFieldName('Height', TableMap::TYPE_PHPNAME, $indexType)]; $this->height = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : MediaTableMap::translateFieldName('Size', TableMap::TYPE_PHPNAME, $indexType)]; $this->size = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : MediaTableMap::translateFieldName('Sha1', TableMap::TYPE_PHPNAME, $indexType)]; $this->sha1 = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : MediaTableMap::translateFieldName('Thumburl', TableMap::TYPE_PHPNAME, $indexType)]; $this->thumburl = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : MediaTableMap::translateFieldName('Thumbmime', TableMap::TYPE_PHPNAME, $indexType)]; $this->thumbmime = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : MediaTableMap::translateFieldName('Thumbwidth', TableMap::TYPE_PHPNAME, $indexType)]; $this->thumbwidth = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : MediaTableMap::translateFieldName('Thumbheight', TableMap::TYPE_PHPNAME, $indexType)]; $this->thumbheight = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : MediaTableMap::translateFieldName('Thumbsize', TableMap::TYPE_PHPNAME, $indexType)]; $this->thumbsize = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : MediaTableMap::translateFieldName('Descriptionurl', TableMap::TYPE_PHPNAME, $indexType)]; $this->descriptionurl = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : MediaTableMap::translateFieldName('Descriptionurlshort', TableMap::TYPE_PHPNAME, $indexType)]; $this->descriptionurlshort = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : MediaTableMap::translateFieldName('Imagedescription', TableMap::TYPE_PHPNAME, $indexType)]; $this->imagedescription = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 18 + $startcol : MediaTableMap::translateFieldName('Datetimeoriginal', TableMap::TYPE_PHPNAME, $indexType)]; $this->datetimeoriginal = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 19 + $startcol : MediaTableMap::translateFieldName('Artist', TableMap::TYPE_PHPNAME, $indexType)]; $this->artist = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 20 + $startcol : MediaTableMap::translateFieldName('Licenseshortname', TableMap::TYPE_PHPNAME, $indexType)]; $this->licenseshortname = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 21 + $startcol : MediaTableMap::translateFieldName('Usageterms', TableMap::TYPE_PHPNAME, $indexType)]; $this->usageterms = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 22 + $startcol : MediaTableMap::translateFieldName('Attributionrequired', TableMap::TYPE_PHPNAME, $indexType)]; $this->attributionrequired = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 23 + $startcol : MediaTableMap::translateFieldName('Restrictions', TableMap::TYPE_PHPNAME, $indexType)]; $this->restrictions = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 24 + $startcol : MediaTableMap::translateFieldName('Timestamp', TableMap::TYPE_PHPNAME, $indexType)]; $this->timestamp = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 25 + $startcol : MediaTableMap::translateFieldName('User', TableMap::TYPE_PHPNAME, $indexType)]; $this->user = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 26 + $startcol : MediaTableMap::translateFieldName('Userid', TableMap::TYPE_PHPNAME, $indexType)]; $this->userid = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 27 + $startcol : MediaTableMap::translateFieldName('Missing', TableMap::TYPE_PHPNAME, $indexType)]; $this->missing = (null !== $col) ? (boolean) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 28 + $startcol : MediaTableMap::translateFieldName('Known', TableMap::TYPE_PHPNAME, $indexType)]; $this->known = (null !== $col) ? (boolean) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 29 + $startcol : MediaTableMap::translateFieldName('Imagerepository', TableMap::TYPE_PHPNAME, $indexType)]; $this->imagerepository = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 30 + $startcol : MediaTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 31 + $startcol : MediaTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; $this->resetModified(); $this->setNew(false); if ($rehydrate) { $this->ensureConsistency(); } return $startcol + 32; // 32 = MediaTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\Attogram\\SharedMedia\\Orm\\Media'), 0, $e); } }
php
public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) { try { $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : MediaTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : MediaTableMap::translateFieldName('SourceId', TableMap::TYPE_PHPNAME, $indexType)]; $this->source_id = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : MediaTableMap::translateFieldName('Pageid', TableMap::TYPE_PHPNAME, $indexType)]; $this->pageid = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MediaTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; $this->title = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MediaTableMap::translateFieldName('Url', TableMap::TYPE_PHPNAME, $indexType)]; $this->url = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MediaTableMap::translateFieldName('Mime', TableMap::TYPE_PHPNAME, $indexType)]; $this->mime = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : MediaTableMap::translateFieldName('Width', TableMap::TYPE_PHPNAME, $indexType)]; $this->width = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : MediaTableMap::translateFieldName('Height', TableMap::TYPE_PHPNAME, $indexType)]; $this->height = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : MediaTableMap::translateFieldName('Size', TableMap::TYPE_PHPNAME, $indexType)]; $this->size = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : MediaTableMap::translateFieldName('Sha1', TableMap::TYPE_PHPNAME, $indexType)]; $this->sha1 = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : MediaTableMap::translateFieldName('Thumburl', TableMap::TYPE_PHPNAME, $indexType)]; $this->thumburl = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : MediaTableMap::translateFieldName('Thumbmime', TableMap::TYPE_PHPNAME, $indexType)]; $this->thumbmime = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : MediaTableMap::translateFieldName('Thumbwidth', TableMap::TYPE_PHPNAME, $indexType)]; $this->thumbwidth = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : MediaTableMap::translateFieldName('Thumbheight', TableMap::TYPE_PHPNAME, $indexType)]; $this->thumbheight = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : MediaTableMap::translateFieldName('Thumbsize', TableMap::TYPE_PHPNAME, $indexType)]; $this->thumbsize = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : MediaTableMap::translateFieldName('Descriptionurl', TableMap::TYPE_PHPNAME, $indexType)]; $this->descriptionurl = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : MediaTableMap::translateFieldName('Descriptionurlshort', TableMap::TYPE_PHPNAME, $indexType)]; $this->descriptionurlshort = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : MediaTableMap::translateFieldName('Imagedescription', TableMap::TYPE_PHPNAME, $indexType)]; $this->imagedescription = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 18 + $startcol : MediaTableMap::translateFieldName('Datetimeoriginal', TableMap::TYPE_PHPNAME, $indexType)]; $this->datetimeoriginal = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 19 + $startcol : MediaTableMap::translateFieldName('Artist', TableMap::TYPE_PHPNAME, $indexType)]; $this->artist = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 20 + $startcol : MediaTableMap::translateFieldName('Licenseshortname', TableMap::TYPE_PHPNAME, $indexType)]; $this->licenseshortname = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 21 + $startcol : MediaTableMap::translateFieldName('Usageterms', TableMap::TYPE_PHPNAME, $indexType)]; $this->usageterms = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 22 + $startcol : MediaTableMap::translateFieldName('Attributionrequired', TableMap::TYPE_PHPNAME, $indexType)]; $this->attributionrequired = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 23 + $startcol : MediaTableMap::translateFieldName('Restrictions', TableMap::TYPE_PHPNAME, $indexType)]; $this->restrictions = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 24 + $startcol : MediaTableMap::translateFieldName('Timestamp', TableMap::TYPE_PHPNAME, $indexType)]; $this->timestamp = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 25 + $startcol : MediaTableMap::translateFieldName('User', TableMap::TYPE_PHPNAME, $indexType)]; $this->user = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 26 + $startcol : MediaTableMap::translateFieldName('Userid', TableMap::TYPE_PHPNAME, $indexType)]; $this->userid = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 27 + $startcol : MediaTableMap::translateFieldName('Missing', TableMap::TYPE_PHPNAME, $indexType)]; $this->missing = (null !== $col) ? (boolean) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 28 + $startcol : MediaTableMap::translateFieldName('Known', TableMap::TYPE_PHPNAME, $indexType)]; $this->known = (null !== $col) ? (boolean) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 29 + $startcol : MediaTableMap::translateFieldName('Imagerepository', TableMap::TYPE_PHPNAME, $indexType)]; $this->imagerepository = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 30 + $startcol : MediaTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 31 + $startcol : MediaTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; $this->resetModified(); $this->setNew(false); if ($rehydrate) { $this->ensureConsistency(); } return $startcol + 32; // 32 = MediaTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\Attogram\\SharedMedia\\Orm\\Media'), 0, $e); } }
Hydrates (populates) the object variables with values from the database resultset. An offset (0-based "start column") is specified so that objects can be hydrated with a subset of the columns in the resultset rows. This is needed, for example, for results of JOIN queries where the resultset row includes columns from two or more tables. @param array $row The row returned by DataFetcher->fetch(). @param int $startcol 0-based offset column which indicates which restultset column to start with. @param boolean $rehydrate Whether this object is being re-hydrated from the database. @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. @return int next starting column @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1622-L1734
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.reload
public function reload($deep = false, ConnectionInterface $con = null) { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); } if ($this->isNew()) { throw new PropelException("Cannot reload an unsaved object."); } if ($con === null) { $con = Propel::getServiceContainer()->getReadConnection(MediaTableMap::DATABASE_NAME); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. $dataFetcher = ChildMediaQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $row = $dataFetcher->fetch(); $dataFetcher->close(); if (!$row) { throw new PropelException('Cannot find matching row in the database to reload object values.'); } $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate if ($deep) { // also de-associate any related objects? $this->aSource = null; $this->collC2Ms = null; $this->collM2Ps = null; } // if (deep) }
php
public function reload($deep = false, ConnectionInterface $con = null) { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); } if ($this->isNew()) { throw new PropelException("Cannot reload an unsaved object."); } if ($con === null) { $con = Propel::getServiceContainer()->getReadConnection(MediaTableMap::DATABASE_NAME); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. $dataFetcher = ChildMediaQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $row = $dataFetcher->fetch(); $dataFetcher->close(); if (!$row) { throw new PropelException('Cannot find matching row in the database to reload object values.'); } $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate if ($deep) { // also de-associate any related objects? $this->aSource = null; $this->collC2Ms = null; $this->collM2Ps = null; } // if (deep) }
Reloads this object from datastore based on primary key and (optionally) resets all associated objects. This will only work if the object has been saved and has a valid primary key set. @param boolean $deep (optional) Whether to also de-associated any related objects. @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. @return void @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1766-L1799
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.doSave
protected function doSave(ConnectionInterface $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // We call the save method on the following object(s) if they // were passed to this object by their corresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aSource !== null) { if ($this->aSource->isModified() || $this->aSource->isNew()) { $affectedRows += $this->aSource->save($con); } $this->setSource($this->aSource); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); $affectedRows += 1; } else { $affectedRows += $this->doUpdate($con); } $this->resetModified(); } if ($this->c2MsScheduledForDeletion !== null) { if (!$this->c2MsScheduledForDeletion->isEmpty()) { \Attogram\SharedMedia\Orm\C2MQuery::create() ->filterByPrimaryKeys($this->c2MsScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); $this->c2MsScheduledForDeletion = null; } } if ($this->collC2Ms !== null) { foreach ($this->collC2Ms as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->m2PsScheduledForDeletion !== null) { if (!$this->m2PsScheduledForDeletion->isEmpty()) { \Attogram\SharedMedia\Orm\M2PQuery::create() ->filterByPrimaryKeys($this->m2PsScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); $this->m2PsScheduledForDeletion = null; } } if ($this->collM2Ps !== null) { foreach ($this->collM2Ps as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
php
protected function doSave(ConnectionInterface $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // We call the save method on the following object(s) if they // were passed to this object by their corresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aSource !== null) { if ($this->aSource->isModified() || $this->aSource->isNew()) { $affectedRows += $this->aSource->save($con); } $this->setSource($this->aSource); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); $affectedRows += 1; } else { $affectedRows += $this->doUpdate($con); } $this->resetModified(); } if ($this->c2MsScheduledForDeletion !== null) { if (!$this->c2MsScheduledForDeletion->isEmpty()) { \Attogram\SharedMedia\Orm\C2MQuery::create() ->filterByPrimaryKeys($this->c2MsScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); $this->c2MsScheduledForDeletion = null; } } if ($this->collC2Ms !== null) { foreach ($this->collC2Ms as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->m2PsScheduledForDeletion !== null) { if (!$this->m2PsScheduledForDeletion->isEmpty()) { \Attogram\SharedMedia\Orm\M2PQuery::create() ->filterByPrimaryKeys($this->m2PsScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); $this->m2PsScheduledForDeletion = null; } } if ($this->collM2Ps !== null) { foreach ($this->collM2Ps as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
Performs the work of inserting or updating the row in the database. If the object is new, it inserts it; otherwise an update is performed. All related objects are also updated in this method. @param ConnectionInterface $con @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. @throws PropelException @see save()
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1907-L1975
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.doInsert
protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[MediaTableMap::COL_ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . MediaTableMap::COL_ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(MediaTableMap::COL_ID)) { $modifiedColumns[':p' . $index++] = 'id'; } if ($this->isColumnModified(MediaTableMap::COL_SOURCE_ID)) { $modifiedColumns[':p' . $index++] = 'source_id'; } if ($this->isColumnModified(MediaTableMap::COL_PAGEID)) { $modifiedColumns[':p' . $index++] = 'pageid'; } if ($this->isColumnModified(MediaTableMap::COL_TITLE)) { $modifiedColumns[':p' . $index++] = 'title'; } if ($this->isColumnModified(MediaTableMap::COL_URL)) { $modifiedColumns[':p' . $index++] = 'url'; } if ($this->isColumnModified(MediaTableMap::COL_MIME)) { $modifiedColumns[':p' . $index++] = 'mime'; } if ($this->isColumnModified(MediaTableMap::COL_WIDTH)) { $modifiedColumns[':p' . $index++] = 'width'; } if ($this->isColumnModified(MediaTableMap::COL_HEIGHT)) { $modifiedColumns[':p' . $index++] = 'height'; } if ($this->isColumnModified(MediaTableMap::COL_SIZE)) { $modifiedColumns[':p' . $index++] = 'size'; } if ($this->isColumnModified(MediaTableMap::COL_SHA1)) { $modifiedColumns[':p' . $index++] = 'sha1'; } if ($this->isColumnModified(MediaTableMap::COL_THUMBURL)) { $modifiedColumns[':p' . $index++] = 'thumburl'; } if ($this->isColumnModified(MediaTableMap::COL_THUMBMIME)) { $modifiedColumns[':p' . $index++] = 'thumbmime'; } if ($this->isColumnModified(MediaTableMap::COL_THUMBWIDTH)) { $modifiedColumns[':p' . $index++] = 'thumbwidth'; } if ($this->isColumnModified(MediaTableMap::COL_THUMBHEIGHT)) { $modifiedColumns[':p' . $index++] = 'thumbheight'; } if ($this->isColumnModified(MediaTableMap::COL_THUMBSIZE)) { $modifiedColumns[':p' . $index++] = 'thumbsize'; } if ($this->isColumnModified(MediaTableMap::COL_DESCRIPTIONURL)) { $modifiedColumns[':p' . $index++] = 'descriptionurl'; } if ($this->isColumnModified(MediaTableMap::COL_DESCRIPTIONURLSHORT)) { $modifiedColumns[':p' . $index++] = 'descriptionurlshort'; } if ($this->isColumnModified(MediaTableMap::COL_IMAGEDESCRIPTION)) { $modifiedColumns[':p' . $index++] = 'imagedescription'; } if ($this->isColumnModified(MediaTableMap::COL_DATETIMEORIGINAL)) { $modifiedColumns[':p' . $index++] = 'datetimeoriginal'; } if ($this->isColumnModified(MediaTableMap::COL_ARTIST)) { $modifiedColumns[':p' . $index++] = 'artist'; } if ($this->isColumnModified(MediaTableMap::COL_LICENSESHORTNAME)) { $modifiedColumns[':p' . $index++] = 'licenseshortname'; } if ($this->isColumnModified(MediaTableMap::COL_USAGETERMS)) { $modifiedColumns[':p' . $index++] = 'usageterms'; } if ($this->isColumnModified(MediaTableMap::COL_ATTRIBUTIONREQUIRED)) { $modifiedColumns[':p' . $index++] = 'attributionrequired'; } if ($this->isColumnModified(MediaTableMap::COL_RESTRICTIONS)) { $modifiedColumns[':p' . $index++] = 'restrictions'; } if ($this->isColumnModified(MediaTableMap::COL_TIMESTAMP)) { $modifiedColumns[':p' . $index++] = 'timestamp'; } if ($this->isColumnModified(MediaTableMap::COL_USER)) { $modifiedColumns[':p' . $index++] = 'user'; } if ($this->isColumnModified(MediaTableMap::COL_USERID)) { $modifiedColumns[':p' . $index++] = 'userid'; } if ($this->isColumnModified(MediaTableMap::COL_MISSING)) { $modifiedColumns[':p' . $index++] = 'missing'; } if ($this->isColumnModified(MediaTableMap::COL_KNOWN)) { $modifiedColumns[':p' . $index++] = 'known'; } if ($this->isColumnModified(MediaTableMap::COL_IMAGEREPOSITORY)) { $modifiedColumns[':p' . $index++] = 'imagerepository'; } if ($this->isColumnModified(MediaTableMap::COL_CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'created_at'; } if ($this->isColumnModified(MediaTableMap::COL_UPDATED_AT)) { $modifiedColumns[':p' . $index++] = 'updated_at'; } $sql = sprintf( 'INSERT INTO media (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); try { $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; case 'source_id': $stmt->bindValue($identifier, $this->source_id, PDO::PARAM_INT); break; case 'pageid': $stmt->bindValue($identifier, $this->pageid, PDO::PARAM_INT); break; case 'title': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; case 'url': $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR); break; case 'mime': $stmt->bindValue($identifier, $this->mime, PDO::PARAM_STR); break; case 'width': $stmt->bindValue($identifier, $this->width, PDO::PARAM_INT); break; case 'height': $stmt->bindValue($identifier, $this->height, PDO::PARAM_INT); break; case 'size': $stmt->bindValue($identifier, $this->size, PDO::PARAM_INT); break; case 'sha1': $stmt->bindValue($identifier, $this->sha1, PDO::PARAM_STR); break; case 'thumburl': $stmt->bindValue($identifier, $this->thumburl, PDO::PARAM_STR); break; case 'thumbmime': $stmt->bindValue($identifier, $this->thumbmime, PDO::PARAM_STR); break; case 'thumbwidth': $stmt->bindValue($identifier, $this->thumbwidth, PDO::PARAM_INT); break; case 'thumbheight': $stmt->bindValue($identifier, $this->thumbheight, PDO::PARAM_INT); break; case 'thumbsize': $stmt->bindValue($identifier, $this->thumbsize, PDO::PARAM_INT); break; case 'descriptionurl': $stmt->bindValue($identifier, $this->descriptionurl, PDO::PARAM_STR); break; case 'descriptionurlshort': $stmt->bindValue($identifier, $this->descriptionurlshort, PDO::PARAM_STR); break; case 'imagedescription': $stmt->bindValue($identifier, $this->imagedescription, PDO::PARAM_STR); break; case 'datetimeoriginal': $stmt->bindValue($identifier, $this->datetimeoriginal, PDO::PARAM_STR); break; case 'artist': $stmt->bindValue($identifier, $this->artist, PDO::PARAM_STR); break; case 'licenseshortname': $stmt->bindValue($identifier, $this->licenseshortname, PDO::PARAM_STR); break; case 'usageterms': $stmt->bindValue($identifier, $this->usageterms, PDO::PARAM_STR); break; case 'attributionrequired': $stmt->bindValue($identifier, $this->attributionrequired, PDO::PARAM_STR); break; case 'restrictions': $stmt->bindValue($identifier, $this->restrictions, PDO::PARAM_STR); break; case 'timestamp': $stmt->bindValue($identifier, $this->timestamp ? $this->timestamp->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); break; case 'user': $stmt->bindValue($identifier, $this->user, PDO::PARAM_STR); break; case 'userid': $stmt->bindValue($identifier, $this->userid, PDO::PARAM_INT); break; case 'missing': $stmt->bindValue($identifier, $this->missing, PDO::PARAM_BOOL); break; case 'known': $stmt->bindValue($identifier, $this->known, PDO::PARAM_BOOL); break; case 'imagerepository': $stmt->bindValue($identifier, $this->imagerepository, PDO::PARAM_STR); break; case 'created_at': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); break; case 'updated_at': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); break; } } $stmt->execute(); } catch (Exception $e) { Propel::log($e->getMessage(), Propel::LOG_ERR); throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e); } try { $pk = $con->lastInsertId(); } catch (Exception $e) { throw new PropelException('Unable to get autoincrement id.', 0, $e); } $this->setId($pk); $this->setNew(false); }
php
protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[MediaTableMap::COL_ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . MediaTableMap::COL_ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(MediaTableMap::COL_ID)) { $modifiedColumns[':p' . $index++] = 'id'; } if ($this->isColumnModified(MediaTableMap::COL_SOURCE_ID)) { $modifiedColumns[':p' . $index++] = 'source_id'; } if ($this->isColumnModified(MediaTableMap::COL_PAGEID)) { $modifiedColumns[':p' . $index++] = 'pageid'; } if ($this->isColumnModified(MediaTableMap::COL_TITLE)) { $modifiedColumns[':p' . $index++] = 'title'; } if ($this->isColumnModified(MediaTableMap::COL_URL)) { $modifiedColumns[':p' . $index++] = 'url'; } if ($this->isColumnModified(MediaTableMap::COL_MIME)) { $modifiedColumns[':p' . $index++] = 'mime'; } if ($this->isColumnModified(MediaTableMap::COL_WIDTH)) { $modifiedColumns[':p' . $index++] = 'width'; } if ($this->isColumnModified(MediaTableMap::COL_HEIGHT)) { $modifiedColumns[':p' . $index++] = 'height'; } if ($this->isColumnModified(MediaTableMap::COL_SIZE)) { $modifiedColumns[':p' . $index++] = 'size'; } if ($this->isColumnModified(MediaTableMap::COL_SHA1)) { $modifiedColumns[':p' . $index++] = 'sha1'; } if ($this->isColumnModified(MediaTableMap::COL_THUMBURL)) { $modifiedColumns[':p' . $index++] = 'thumburl'; } if ($this->isColumnModified(MediaTableMap::COL_THUMBMIME)) { $modifiedColumns[':p' . $index++] = 'thumbmime'; } if ($this->isColumnModified(MediaTableMap::COL_THUMBWIDTH)) { $modifiedColumns[':p' . $index++] = 'thumbwidth'; } if ($this->isColumnModified(MediaTableMap::COL_THUMBHEIGHT)) { $modifiedColumns[':p' . $index++] = 'thumbheight'; } if ($this->isColumnModified(MediaTableMap::COL_THUMBSIZE)) { $modifiedColumns[':p' . $index++] = 'thumbsize'; } if ($this->isColumnModified(MediaTableMap::COL_DESCRIPTIONURL)) { $modifiedColumns[':p' . $index++] = 'descriptionurl'; } if ($this->isColumnModified(MediaTableMap::COL_DESCRIPTIONURLSHORT)) { $modifiedColumns[':p' . $index++] = 'descriptionurlshort'; } if ($this->isColumnModified(MediaTableMap::COL_IMAGEDESCRIPTION)) { $modifiedColumns[':p' . $index++] = 'imagedescription'; } if ($this->isColumnModified(MediaTableMap::COL_DATETIMEORIGINAL)) { $modifiedColumns[':p' . $index++] = 'datetimeoriginal'; } if ($this->isColumnModified(MediaTableMap::COL_ARTIST)) { $modifiedColumns[':p' . $index++] = 'artist'; } if ($this->isColumnModified(MediaTableMap::COL_LICENSESHORTNAME)) { $modifiedColumns[':p' . $index++] = 'licenseshortname'; } if ($this->isColumnModified(MediaTableMap::COL_USAGETERMS)) { $modifiedColumns[':p' . $index++] = 'usageterms'; } if ($this->isColumnModified(MediaTableMap::COL_ATTRIBUTIONREQUIRED)) { $modifiedColumns[':p' . $index++] = 'attributionrequired'; } if ($this->isColumnModified(MediaTableMap::COL_RESTRICTIONS)) { $modifiedColumns[':p' . $index++] = 'restrictions'; } if ($this->isColumnModified(MediaTableMap::COL_TIMESTAMP)) { $modifiedColumns[':p' . $index++] = 'timestamp'; } if ($this->isColumnModified(MediaTableMap::COL_USER)) { $modifiedColumns[':p' . $index++] = 'user'; } if ($this->isColumnModified(MediaTableMap::COL_USERID)) { $modifiedColumns[':p' . $index++] = 'userid'; } if ($this->isColumnModified(MediaTableMap::COL_MISSING)) { $modifiedColumns[':p' . $index++] = 'missing'; } if ($this->isColumnModified(MediaTableMap::COL_KNOWN)) { $modifiedColumns[':p' . $index++] = 'known'; } if ($this->isColumnModified(MediaTableMap::COL_IMAGEREPOSITORY)) { $modifiedColumns[':p' . $index++] = 'imagerepository'; } if ($this->isColumnModified(MediaTableMap::COL_CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'created_at'; } if ($this->isColumnModified(MediaTableMap::COL_UPDATED_AT)) { $modifiedColumns[':p' . $index++] = 'updated_at'; } $sql = sprintf( 'INSERT INTO media (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); try { $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; case 'source_id': $stmt->bindValue($identifier, $this->source_id, PDO::PARAM_INT); break; case 'pageid': $stmt->bindValue($identifier, $this->pageid, PDO::PARAM_INT); break; case 'title': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; case 'url': $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR); break; case 'mime': $stmt->bindValue($identifier, $this->mime, PDO::PARAM_STR); break; case 'width': $stmt->bindValue($identifier, $this->width, PDO::PARAM_INT); break; case 'height': $stmt->bindValue($identifier, $this->height, PDO::PARAM_INT); break; case 'size': $stmt->bindValue($identifier, $this->size, PDO::PARAM_INT); break; case 'sha1': $stmt->bindValue($identifier, $this->sha1, PDO::PARAM_STR); break; case 'thumburl': $stmt->bindValue($identifier, $this->thumburl, PDO::PARAM_STR); break; case 'thumbmime': $stmt->bindValue($identifier, $this->thumbmime, PDO::PARAM_STR); break; case 'thumbwidth': $stmt->bindValue($identifier, $this->thumbwidth, PDO::PARAM_INT); break; case 'thumbheight': $stmt->bindValue($identifier, $this->thumbheight, PDO::PARAM_INT); break; case 'thumbsize': $stmt->bindValue($identifier, $this->thumbsize, PDO::PARAM_INT); break; case 'descriptionurl': $stmt->bindValue($identifier, $this->descriptionurl, PDO::PARAM_STR); break; case 'descriptionurlshort': $stmt->bindValue($identifier, $this->descriptionurlshort, PDO::PARAM_STR); break; case 'imagedescription': $stmt->bindValue($identifier, $this->imagedescription, PDO::PARAM_STR); break; case 'datetimeoriginal': $stmt->bindValue($identifier, $this->datetimeoriginal, PDO::PARAM_STR); break; case 'artist': $stmt->bindValue($identifier, $this->artist, PDO::PARAM_STR); break; case 'licenseshortname': $stmt->bindValue($identifier, $this->licenseshortname, PDO::PARAM_STR); break; case 'usageterms': $stmt->bindValue($identifier, $this->usageterms, PDO::PARAM_STR); break; case 'attributionrequired': $stmt->bindValue($identifier, $this->attributionrequired, PDO::PARAM_STR); break; case 'restrictions': $stmt->bindValue($identifier, $this->restrictions, PDO::PARAM_STR); break; case 'timestamp': $stmt->bindValue($identifier, $this->timestamp ? $this->timestamp->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); break; case 'user': $stmt->bindValue($identifier, $this->user, PDO::PARAM_STR); break; case 'userid': $stmt->bindValue($identifier, $this->userid, PDO::PARAM_INT); break; case 'missing': $stmt->bindValue($identifier, $this->missing, PDO::PARAM_BOOL); break; case 'known': $stmt->bindValue($identifier, $this->known, PDO::PARAM_BOOL); break; case 'imagerepository': $stmt->bindValue($identifier, $this->imagerepository, PDO::PARAM_STR); break; case 'created_at': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); break; case 'updated_at': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); break; } } $stmt->execute(); } catch (Exception $e) { Propel::log($e->getMessage(), Propel::LOG_ERR); throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e); } try { $pk = $con->lastInsertId(); } catch (Exception $e) { throw new PropelException('Unable to get autoincrement id.', 0, $e); } $this->setId($pk); $this->setNew(false); }
Insert the row in the database. @param ConnectionInterface $con @throws PropelException @see doSave()
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L1985-L2215
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.getByPosition
public function getByPosition($pos) { switch ($pos) { case 0: return $this->getId(); break; case 1: return $this->getSourceId(); break; case 2: return $this->getPageid(); break; case 3: return $this->getTitle(); break; case 4: return $this->getUrl(); break; case 5: return $this->getMime(); break; case 6: return $this->getWidth(); break; case 7: return $this->getHeight(); break; case 8: return $this->getSize(); break; case 9: return $this->getSha1(); break; case 10: return $this->getThumburl(); break; case 11: return $this->getThumbmime(); break; case 12: return $this->getThumbwidth(); break; case 13: return $this->getThumbheight(); break; case 14: return $this->getThumbsize(); break; case 15: return $this->getDescriptionurl(); break; case 16: return $this->getDescriptionurlshort(); break; case 17: return $this->getImagedescription(); break; case 18: return $this->getDatetimeoriginal(); break; case 19: return $this->getArtist(); break; case 20: return $this->getLicenseshortname(); break; case 21: return $this->getUsageterms(); break; case 22: return $this->getAttributionrequired(); break; case 23: return $this->getRestrictions(); break; case 24: return $this->getTimestamp(); break; case 25: return $this->getUser(); break; case 26: return $this->getUserid(); break; case 27: return $this->getMissing(); break; case 28: return $this->getKnown(); break; case 29: return $this->getImagerepository(); break; case 30: return $this->getCreatedAt(); break; case 31: return $this->getUpdatedAt(); break; default: return null; break; } // switch() }
php
public function getByPosition($pos) { switch ($pos) { case 0: return $this->getId(); break; case 1: return $this->getSourceId(); break; case 2: return $this->getPageid(); break; case 3: return $this->getTitle(); break; case 4: return $this->getUrl(); break; case 5: return $this->getMime(); break; case 6: return $this->getWidth(); break; case 7: return $this->getHeight(); break; case 8: return $this->getSize(); break; case 9: return $this->getSha1(); break; case 10: return $this->getThumburl(); break; case 11: return $this->getThumbmime(); break; case 12: return $this->getThumbwidth(); break; case 13: return $this->getThumbheight(); break; case 14: return $this->getThumbsize(); break; case 15: return $this->getDescriptionurl(); break; case 16: return $this->getDescriptionurlshort(); break; case 17: return $this->getImagedescription(); break; case 18: return $this->getDatetimeoriginal(); break; case 19: return $this->getArtist(); break; case 20: return $this->getLicenseshortname(); break; case 21: return $this->getUsageterms(); break; case 22: return $this->getAttributionrequired(); break; case 23: return $this->getRestrictions(); break; case 24: return $this->getTimestamp(); break; case 25: return $this->getUser(); break; case 26: return $this->getUserid(); break; case 27: return $this->getMissing(); break; case 28: return $this->getKnown(); break; case 29: return $this->getImagerepository(); break; case 30: return $this->getCreatedAt(); break; case 31: return $this->getUpdatedAt(); break; default: return null; break; } // switch() }
Retrieves a field from the object by Position as specified in the xml schema. Zero-based. @param int $pos position in xml schema @return mixed Value of field at $pos
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L2258-L2361
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.toArray
public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['Media'][$this->hashCode()])) { return '*RECURSION*'; } $alreadyDumpedObjects['Media'][$this->hashCode()] = true; $keys = MediaTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getSourceId(), $keys[2] => $this->getPageid(), $keys[3] => $this->getTitle(), $keys[4] => $this->getUrl(), $keys[5] => $this->getMime(), $keys[6] => $this->getWidth(), $keys[7] => $this->getHeight(), $keys[8] => $this->getSize(), $keys[9] => $this->getSha1(), $keys[10] => $this->getThumburl(), $keys[11] => $this->getThumbmime(), $keys[12] => $this->getThumbwidth(), $keys[13] => $this->getThumbheight(), $keys[14] => $this->getThumbsize(), $keys[15] => $this->getDescriptionurl(), $keys[16] => $this->getDescriptionurlshort(), $keys[17] => $this->getImagedescription(), $keys[18] => $this->getDatetimeoriginal(), $keys[19] => $this->getArtist(), $keys[20] => $this->getLicenseshortname(), $keys[21] => $this->getUsageterms(), $keys[22] => $this->getAttributionrequired(), $keys[23] => $this->getRestrictions(), $keys[24] => $this->getTimestamp(), $keys[25] => $this->getUser(), $keys[26] => $this->getUserid(), $keys[27] => $this->getMissing(), $keys[28] => $this->getKnown(), $keys[29] => $this->getImagerepository(), $keys[30] => $this->getCreatedAt(), $keys[31] => $this->getUpdatedAt(), ); if ($result[$keys[24]] instanceof \DateTimeInterface) { $result[$keys[24]] = $result[$keys[24]]->format('c'); } if ($result[$keys[30]] instanceof \DateTimeInterface) { $result[$keys[30]] = $result[$keys[30]]->format('c'); } if ($result[$keys[31]] instanceof \DateTimeInterface) { $result[$keys[31]] = $result[$keys[31]]->format('c'); } $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aSource) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'source'; break; case TableMap::TYPE_FIELDNAME: $key = 'source'; break; default: $key = 'Source'; } $result[$key] = $this->aSource->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collC2Ms) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'c2Ms'; break; case TableMap::TYPE_FIELDNAME: $key = 'c2ms'; break; default: $key = 'C2Ms'; } $result[$key] = $this->collC2Ms->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collM2Ps) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'm2Ps'; break; case TableMap::TYPE_FIELDNAME: $key = 'm2ps'; break; default: $key = 'M2Ps'; } $result[$key] = $this->collM2Ps->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } return $result; }
php
public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['Media'][$this->hashCode()])) { return '*RECURSION*'; } $alreadyDumpedObjects['Media'][$this->hashCode()] = true; $keys = MediaTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getSourceId(), $keys[2] => $this->getPageid(), $keys[3] => $this->getTitle(), $keys[4] => $this->getUrl(), $keys[5] => $this->getMime(), $keys[6] => $this->getWidth(), $keys[7] => $this->getHeight(), $keys[8] => $this->getSize(), $keys[9] => $this->getSha1(), $keys[10] => $this->getThumburl(), $keys[11] => $this->getThumbmime(), $keys[12] => $this->getThumbwidth(), $keys[13] => $this->getThumbheight(), $keys[14] => $this->getThumbsize(), $keys[15] => $this->getDescriptionurl(), $keys[16] => $this->getDescriptionurlshort(), $keys[17] => $this->getImagedescription(), $keys[18] => $this->getDatetimeoriginal(), $keys[19] => $this->getArtist(), $keys[20] => $this->getLicenseshortname(), $keys[21] => $this->getUsageterms(), $keys[22] => $this->getAttributionrequired(), $keys[23] => $this->getRestrictions(), $keys[24] => $this->getTimestamp(), $keys[25] => $this->getUser(), $keys[26] => $this->getUserid(), $keys[27] => $this->getMissing(), $keys[28] => $this->getKnown(), $keys[29] => $this->getImagerepository(), $keys[30] => $this->getCreatedAt(), $keys[31] => $this->getUpdatedAt(), ); if ($result[$keys[24]] instanceof \DateTimeInterface) { $result[$keys[24]] = $result[$keys[24]]->format('c'); } if ($result[$keys[30]] instanceof \DateTimeInterface) { $result[$keys[30]] = $result[$keys[30]]->format('c'); } if ($result[$keys[31]] instanceof \DateTimeInterface) { $result[$keys[31]] = $result[$keys[31]]->format('c'); } $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aSource) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'source'; break; case TableMap::TYPE_FIELDNAME: $key = 'source'; break; default: $key = 'Source'; } $result[$key] = $this->aSource->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collC2Ms) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'c2Ms'; break; case TableMap::TYPE_FIELDNAME: $key = 'c2ms'; break; default: $key = 'C2Ms'; } $result[$key] = $this->collC2Ms->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collM2Ps) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'm2Ps'; break; case TableMap::TYPE_FIELDNAME: $key = 'm2ps'; break; default: $key = 'M2Ps'; } $result[$key] = $this->collM2Ps->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } return $result; }
Exports the object as an array. You can specify the key type of the array by passing one of the class type constants. @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. @param array $alreadyDumpedObjects List of objects to skip to avoid recursion @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. @return array an associative array containing the field names (as keys) and field values
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L2378-L2486
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setByPosition
public function setByPosition($pos, $value) { switch ($pos) { case 0: $this->setId($value); break; case 1: $this->setSourceId($value); break; case 2: $this->setPageid($value); break; case 3: $this->setTitle($value); break; case 4: $this->setUrl($value); break; case 5: $this->setMime($value); break; case 6: $this->setWidth($value); break; case 7: $this->setHeight($value); break; case 8: $this->setSize($value); break; case 9: $this->setSha1($value); break; case 10: $this->setThumburl($value); break; case 11: $this->setThumbmime($value); break; case 12: $this->setThumbwidth($value); break; case 13: $this->setThumbheight($value); break; case 14: $this->setThumbsize($value); break; case 15: $this->setDescriptionurl($value); break; case 16: $this->setDescriptionurlshort($value); break; case 17: $this->setImagedescription($value); break; case 18: $this->setDatetimeoriginal($value); break; case 19: $this->setArtist($value); break; case 20: $this->setLicenseshortname($value); break; case 21: $this->setUsageterms($value); break; case 22: $this->setAttributionrequired($value); break; case 23: $this->setRestrictions($value); break; case 24: $this->setTimestamp($value); break; case 25: $this->setUser($value); break; case 26: $this->setUserid($value); break; case 27: $this->setMissing($value); break; case 28: $this->setKnown($value); break; case 29: $this->setImagerepository($value); break; case 30: $this->setCreatedAt($value); break; case 31: $this->setUpdatedAt($value); break; } // switch() return $this; }
php
public function setByPosition($pos, $value) { switch ($pos) { case 0: $this->setId($value); break; case 1: $this->setSourceId($value); break; case 2: $this->setPageid($value); break; case 3: $this->setTitle($value); break; case 4: $this->setUrl($value); break; case 5: $this->setMime($value); break; case 6: $this->setWidth($value); break; case 7: $this->setHeight($value); break; case 8: $this->setSize($value); break; case 9: $this->setSha1($value); break; case 10: $this->setThumburl($value); break; case 11: $this->setThumbmime($value); break; case 12: $this->setThumbwidth($value); break; case 13: $this->setThumbheight($value); break; case 14: $this->setThumbsize($value); break; case 15: $this->setDescriptionurl($value); break; case 16: $this->setDescriptionurlshort($value); break; case 17: $this->setImagedescription($value); break; case 18: $this->setDatetimeoriginal($value); break; case 19: $this->setArtist($value); break; case 20: $this->setLicenseshortname($value); break; case 21: $this->setUsageterms($value); break; case 22: $this->setAttributionrequired($value); break; case 23: $this->setRestrictions($value); break; case 24: $this->setTimestamp($value); break; case 25: $this->setUser($value); break; case 26: $this->setUserid($value); break; case 27: $this->setMissing($value); break; case 28: $this->setKnown($value); break; case 29: $this->setImagerepository($value); break; case 30: $this->setCreatedAt($value); break; case 31: $this->setUpdatedAt($value); break; } // switch() return $this; }
Sets a field from the object by Position as specified in the xml schema. Zero-based. @param int $pos position in xml schema @param mixed $value field value @return $this|\Attogram\SharedMedia\Orm\Media
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L2514-L2616
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.fromArray
public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) { $keys = MediaTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setSourceId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setPageid($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setTitle($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setUrl($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setMime($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setWidth($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setHeight($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setSize($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setSha1($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setThumburl($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setThumbmime($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setThumbwidth($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setThumbheight($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { $this->setThumbsize($arr[$keys[14]]); } if (array_key_exists($keys[15], $arr)) { $this->setDescriptionurl($arr[$keys[15]]); } if (array_key_exists($keys[16], $arr)) { $this->setDescriptionurlshort($arr[$keys[16]]); } if (array_key_exists($keys[17], $arr)) { $this->setImagedescription($arr[$keys[17]]); } if (array_key_exists($keys[18], $arr)) { $this->setDatetimeoriginal($arr[$keys[18]]); } if (array_key_exists($keys[19], $arr)) { $this->setArtist($arr[$keys[19]]); } if (array_key_exists($keys[20], $arr)) { $this->setLicenseshortname($arr[$keys[20]]); } if (array_key_exists($keys[21], $arr)) { $this->setUsageterms($arr[$keys[21]]); } if (array_key_exists($keys[22], $arr)) { $this->setAttributionrequired($arr[$keys[22]]); } if (array_key_exists($keys[23], $arr)) { $this->setRestrictions($arr[$keys[23]]); } if (array_key_exists($keys[24], $arr)) { $this->setTimestamp($arr[$keys[24]]); } if (array_key_exists($keys[25], $arr)) { $this->setUser($arr[$keys[25]]); } if (array_key_exists($keys[26], $arr)) { $this->setUserid($arr[$keys[26]]); } if (array_key_exists($keys[27], $arr)) { $this->setMissing($arr[$keys[27]]); } if (array_key_exists($keys[28], $arr)) { $this->setKnown($arr[$keys[28]]); } if (array_key_exists($keys[29], $arr)) { $this->setImagerepository($arr[$keys[29]]); } if (array_key_exists($keys[30], $arr)) { $this->setCreatedAt($arr[$keys[30]]); } if (array_key_exists($keys[31], $arr)) { $this->setUpdatedAt($arr[$keys[31]]); } }
php
public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) { $keys = MediaTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setSourceId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setPageid($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setTitle($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setUrl($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setMime($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setWidth($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setHeight($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setSize($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setSha1($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setThumburl($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setThumbmime($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setThumbwidth($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setThumbheight($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { $this->setThumbsize($arr[$keys[14]]); } if (array_key_exists($keys[15], $arr)) { $this->setDescriptionurl($arr[$keys[15]]); } if (array_key_exists($keys[16], $arr)) { $this->setDescriptionurlshort($arr[$keys[16]]); } if (array_key_exists($keys[17], $arr)) { $this->setImagedescription($arr[$keys[17]]); } if (array_key_exists($keys[18], $arr)) { $this->setDatetimeoriginal($arr[$keys[18]]); } if (array_key_exists($keys[19], $arr)) { $this->setArtist($arr[$keys[19]]); } if (array_key_exists($keys[20], $arr)) { $this->setLicenseshortname($arr[$keys[20]]); } if (array_key_exists($keys[21], $arr)) { $this->setUsageterms($arr[$keys[21]]); } if (array_key_exists($keys[22], $arr)) { $this->setAttributionrequired($arr[$keys[22]]); } if (array_key_exists($keys[23], $arr)) { $this->setRestrictions($arr[$keys[23]]); } if (array_key_exists($keys[24], $arr)) { $this->setTimestamp($arr[$keys[24]]); } if (array_key_exists($keys[25], $arr)) { $this->setUser($arr[$keys[25]]); } if (array_key_exists($keys[26], $arr)) { $this->setUserid($arr[$keys[26]]); } if (array_key_exists($keys[27], $arr)) { $this->setMissing($arr[$keys[27]]); } if (array_key_exists($keys[28], $arr)) { $this->setKnown($arr[$keys[28]]); } if (array_key_exists($keys[29], $arr)) { $this->setImagerepository($arr[$keys[29]]); } if (array_key_exists($keys[30], $arr)) { $this->setCreatedAt($arr[$keys[30]]); } if (array_key_exists($keys[31], $arr)) { $this->setUpdatedAt($arr[$keys[31]]); } }
Populates the object using an array. This is particularly useful when populating an object from one of the request arrays (e.g. $_POST). This method goes through the column names, checking to see whether a matching key exists in populated array. If so the setByName() method is called for that column. You can specify the key type of the array by additionally passing one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. The default key type is the column's TableMap::TYPE_PHPNAME. @param array $arr An array to populate the object from. @param string $keyType The type of keys the array uses. @return void
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L2635-L2735
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.buildCriteria
public function buildCriteria() { $criteria = new Criteria(MediaTableMap::DATABASE_NAME); if ($this->isColumnModified(MediaTableMap::COL_ID)) { $criteria->add(MediaTableMap::COL_ID, $this->id); } if ($this->isColumnModified(MediaTableMap::COL_SOURCE_ID)) { $criteria->add(MediaTableMap::COL_SOURCE_ID, $this->source_id); } if ($this->isColumnModified(MediaTableMap::COL_PAGEID)) { $criteria->add(MediaTableMap::COL_PAGEID, $this->pageid); } if ($this->isColumnModified(MediaTableMap::COL_TITLE)) { $criteria->add(MediaTableMap::COL_TITLE, $this->title); } if ($this->isColumnModified(MediaTableMap::COL_URL)) { $criteria->add(MediaTableMap::COL_URL, $this->url); } if ($this->isColumnModified(MediaTableMap::COL_MIME)) { $criteria->add(MediaTableMap::COL_MIME, $this->mime); } if ($this->isColumnModified(MediaTableMap::COL_WIDTH)) { $criteria->add(MediaTableMap::COL_WIDTH, $this->width); } if ($this->isColumnModified(MediaTableMap::COL_HEIGHT)) { $criteria->add(MediaTableMap::COL_HEIGHT, $this->height); } if ($this->isColumnModified(MediaTableMap::COL_SIZE)) { $criteria->add(MediaTableMap::COL_SIZE, $this->size); } if ($this->isColumnModified(MediaTableMap::COL_SHA1)) { $criteria->add(MediaTableMap::COL_SHA1, $this->sha1); } if ($this->isColumnModified(MediaTableMap::COL_THUMBURL)) { $criteria->add(MediaTableMap::COL_THUMBURL, $this->thumburl); } if ($this->isColumnModified(MediaTableMap::COL_THUMBMIME)) { $criteria->add(MediaTableMap::COL_THUMBMIME, $this->thumbmime); } if ($this->isColumnModified(MediaTableMap::COL_THUMBWIDTH)) { $criteria->add(MediaTableMap::COL_THUMBWIDTH, $this->thumbwidth); } if ($this->isColumnModified(MediaTableMap::COL_THUMBHEIGHT)) { $criteria->add(MediaTableMap::COL_THUMBHEIGHT, $this->thumbheight); } if ($this->isColumnModified(MediaTableMap::COL_THUMBSIZE)) { $criteria->add(MediaTableMap::COL_THUMBSIZE, $this->thumbsize); } if ($this->isColumnModified(MediaTableMap::COL_DESCRIPTIONURL)) { $criteria->add(MediaTableMap::COL_DESCRIPTIONURL, $this->descriptionurl); } if ($this->isColumnModified(MediaTableMap::COL_DESCRIPTIONURLSHORT)) { $criteria->add(MediaTableMap::COL_DESCRIPTIONURLSHORT, $this->descriptionurlshort); } if ($this->isColumnModified(MediaTableMap::COL_IMAGEDESCRIPTION)) { $criteria->add(MediaTableMap::COL_IMAGEDESCRIPTION, $this->imagedescription); } if ($this->isColumnModified(MediaTableMap::COL_DATETIMEORIGINAL)) { $criteria->add(MediaTableMap::COL_DATETIMEORIGINAL, $this->datetimeoriginal); } if ($this->isColumnModified(MediaTableMap::COL_ARTIST)) { $criteria->add(MediaTableMap::COL_ARTIST, $this->artist); } if ($this->isColumnModified(MediaTableMap::COL_LICENSESHORTNAME)) { $criteria->add(MediaTableMap::COL_LICENSESHORTNAME, $this->licenseshortname); } if ($this->isColumnModified(MediaTableMap::COL_USAGETERMS)) { $criteria->add(MediaTableMap::COL_USAGETERMS, $this->usageterms); } if ($this->isColumnModified(MediaTableMap::COL_ATTRIBUTIONREQUIRED)) { $criteria->add(MediaTableMap::COL_ATTRIBUTIONREQUIRED, $this->attributionrequired); } if ($this->isColumnModified(MediaTableMap::COL_RESTRICTIONS)) { $criteria->add(MediaTableMap::COL_RESTRICTIONS, $this->restrictions); } if ($this->isColumnModified(MediaTableMap::COL_TIMESTAMP)) { $criteria->add(MediaTableMap::COL_TIMESTAMP, $this->timestamp); } if ($this->isColumnModified(MediaTableMap::COL_USER)) { $criteria->add(MediaTableMap::COL_USER, $this->user); } if ($this->isColumnModified(MediaTableMap::COL_USERID)) { $criteria->add(MediaTableMap::COL_USERID, $this->userid); } if ($this->isColumnModified(MediaTableMap::COL_MISSING)) { $criteria->add(MediaTableMap::COL_MISSING, $this->missing); } if ($this->isColumnModified(MediaTableMap::COL_KNOWN)) { $criteria->add(MediaTableMap::COL_KNOWN, $this->known); } if ($this->isColumnModified(MediaTableMap::COL_IMAGEREPOSITORY)) { $criteria->add(MediaTableMap::COL_IMAGEREPOSITORY, $this->imagerepository); } if ($this->isColumnModified(MediaTableMap::COL_CREATED_AT)) { $criteria->add(MediaTableMap::COL_CREATED_AT, $this->created_at); } if ($this->isColumnModified(MediaTableMap::COL_UPDATED_AT)) { $criteria->add(MediaTableMap::COL_UPDATED_AT, $this->updated_at); } return $criteria; }
php
public function buildCriteria() { $criteria = new Criteria(MediaTableMap::DATABASE_NAME); if ($this->isColumnModified(MediaTableMap::COL_ID)) { $criteria->add(MediaTableMap::COL_ID, $this->id); } if ($this->isColumnModified(MediaTableMap::COL_SOURCE_ID)) { $criteria->add(MediaTableMap::COL_SOURCE_ID, $this->source_id); } if ($this->isColumnModified(MediaTableMap::COL_PAGEID)) { $criteria->add(MediaTableMap::COL_PAGEID, $this->pageid); } if ($this->isColumnModified(MediaTableMap::COL_TITLE)) { $criteria->add(MediaTableMap::COL_TITLE, $this->title); } if ($this->isColumnModified(MediaTableMap::COL_URL)) { $criteria->add(MediaTableMap::COL_URL, $this->url); } if ($this->isColumnModified(MediaTableMap::COL_MIME)) { $criteria->add(MediaTableMap::COL_MIME, $this->mime); } if ($this->isColumnModified(MediaTableMap::COL_WIDTH)) { $criteria->add(MediaTableMap::COL_WIDTH, $this->width); } if ($this->isColumnModified(MediaTableMap::COL_HEIGHT)) { $criteria->add(MediaTableMap::COL_HEIGHT, $this->height); } if ($this->isColumnModified(MediaTableMap::COL_SIZE)) { $criteria->add(MediaTableMap::COL_SIZE, $this->size); } if ($this->isColumnModified(MediaTableMap::COL_SHA1)) { $criteria->add(MediaTableMap::COL_SHA1, $this->sha1); } if ($this->isColumnModified(MediaTableMap::COL_THUMBURL)) { $criteria->add(MediaTableMap::COL_THUMBURL, $this->thumburl); } if ($this->isColumnModified(MediaTableMap::COL_THUMBMIME)) { $criteria->add(MediaTableMap::COL_THUMBMIME, $this->thumbmime); } if ($this->isColumnModified(MediaTableMap::COL_THUMBWIDTH)) { $criteria->add(MediaTableMap::COL_THUMBWIDTH, $this->thumbwidth); } if ($this->isColumnModified(MediaTableMap::COL_THUMBHEIGHT)) { $criteria->add(MediaTableMap::COL_THUMBHEIGHT, $this->thumbheight); } if ($this->isColumnModified(MediaTableMap::COL_THUMBSIZE)) { $criteria->add(MediaTableMap::COL_THUMBSIZE, $this->thumbsize); } if ($this->isColumnModified(MediaTableMap::COL_DESCRIPTIONURL)) { $criteria->add(MediaTableMap::COL_DESCRIPTIONURL, $this->descriptionurl); } if ($this->isColumnModified(MediaTableMap::COL_DESCRIPTIONURLSHORT)) { $criteria->add(MediaTableMap::COL_DESCRIPTIONURLSHORT, $this->descriptionurlshort); } if ($this->isColumnModified(MediaTableMap::COL_IMAGEDESCRIPTION)) { $criteria->add(MediaTableMap::COL_IMAGEDESCRIPTION, $this->imagedescription); } if ($this->isColumnModified(MediaTableMap::COL_DATETIMEORIGINAL)) { $criteria->add(MediaTableMap::COL_DATETIMEORIGINAL, $this->datetimeoriginal); } if ($this->isColumnModified(MediaTableMap::COL_ARTIST)) { $criteria->add(MediaTableMap::COL_ARTIST, $this->artist); } if ($this->isColumnModified(MediaTableMap::COL_LICENSESHORTNAME)) { $criteria->add(MediaTableMap::COL_LICENSESHORTNAME, $this->licenseshortname); } if ($this->isColumnModified(MediaTableMap::COL_USAGETERMS)) { $criteria->add(MediaTableMap::COL_USAGETERMS, $this->usageterms); } if ($this->isColumnModified(MediaTableMap::COL_ATTRIBUTIONREQUIRED)) { $criteria->add(MediaTableMap::COL_ATTRIBUTIONREQUIRED, $this->attributionrequired); } if ($this->isColumnModified(MediaTableMap::COL_RESTRICTIONS)) { $criteria->add(MediaTableMap::COL_RESTRICTIONS, $this->restrictions); } if ($this->isColumnModified(MediaTableMap::COL_TIMESTAMP)) { $criteria->add(MediaTableMap::COL_TIMESTAMP, $this->timestamp); } if ($this->isColumnModified(MediaTableMap::COL_USER)) { $criteria->add(MediaTableMap::COL_USER, $this->user); } if ($this->isColumnModified(MediaTableMap::COL_USERID)) { $criteria->add(MediaTableMap::COL_USERID, $this->userid); } if ($this->isColumnModified(MediaTableMap::COL_MISSING)) { $criteria->add(MediaTableMap::COL_MISSING, $this->missing); } if ($this->isColumnModified(MediaTableMap::COL_KNOWN)) { $criteria->add(MediaTableMap::COL_KNOWN, $this->known); } if ($this->isColumnModified(MediaTableMap::COL_IMAGEREPOSITORY)) { $criteria->add(MediaTableMap::COL_IMAGEREPOSITORY, $this->imagerepository); } if ($this->isColumnModified(MediaTableMap::COL_CREATED_AT)) { $criteria->add(MediaTableMap::COL_CREATED_AT, $this->created_at); } if ($this->isColumnModified(MediaTableMap::COL_UPDATED_AT)) { $criteria->add(MediaTableMap::COL_UPDATED_AT, $this->updated_at); } return $criteria; }
Build a Criteria object containing the values of all modified columns in this object. @return Criteria The Criteria object containing all modified values.
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L2772-L2874
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.buildPkeyCriteria
public function buildPkeyCriteria() { $criteria = ChildMediaQuery::create(); $criteria->add(MediaTableMap::COL_ID, $this->id); return $criteria; }
php
public function buildPkeyCriteria() { $criteria = ChildMediaQuery::create(); $criteria->add(MediaTableMap::COL_ID, $this->id); return $criteria; }
Builds a Criteria object containing the primary key for this object. Unlike buildCriteria() this method includes the primary key values regardless of whether or not they have been modified. @throws LogicException if no primary key is defined @return Criteria The Criteria object containing value(s) for primary key(s).
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L2886-L2892
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.copyInto
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setSourceId($this->getSourceId()); $copyObj->setPageid($this->getPageid()); $copyObj->setTitle($this->getTitle()); $copyObj->setUrl($this->getUrl()); $copyObj->setMime($this->getMime()); $copyObj->setWidth($this->getWidth()); $copyObj->setHeight($this->getHeight()); $copyObj->setSize($this->getSize()); $copyObj->setSha1($this->getSha1()); $copyObj->setThumburl($this->getThumburl()); $copyObj->setThumbmime($this->getThumbmime()); $copyObj->setThumbwidth($this->getThumbwidth()); $copyObj->setThumbheight($this->getThumbheight()); $copyObj->setThumbsize($this->getThumbsize()); $copyObj->setDescriptionurl($this->getDescriptionurl()); $copyObj->setDescriptionurlshort($this->getDescriptionurlshort()); $copyObj->setImagedescription($this->getImagedescription()); $copyObj->setDatetimeoriginal($this->getDatetimeoriginal()); $copyObj->setArtist($this->getArtist()); $copyObj->setLicenseshortname($this->getLicenseshortname()); $copyObj->setUsageterms($this->getUsageterms()); $copyObj->setAttributionrequired($this->getAttributionrequired()); $copyObj->setRestrictions($this->getRestrictions()); $copyObj->setTimestamp($this->getTimestamp()); $copyObj->setUser($this->getUser()); $copyObj->setUserid($this->getUserid()); $copyObj->setMissing($this->getMissing()); $copyObj->setKnown($this->getKnown()); $copyObj->setImagerepository($this->getImagerepository()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getC2Ms() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addC2M($relObj->copy($deepCopy)); } } foreach ($this->getM2Ps() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addM2P($relObj->copy($deepCopy)); } } } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
php
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setSourceId($this->getSourceId()); $copyObj->setPageid($this->getPageid()); $copyObj->setTitle($this->getTitle()); $copyObj->setUrl($this->getUrl()); $copyObj->setMime($this->getMime()); $copyObj->setWidth($this->getWidth()); $copyObj->setHeight($this->getHeight()); $copyObj->setSize($this->getSize()); $copyObj->setSha1($this->getSha1()); $copyObj->setThumburl($this->getThumburl()); $copyObj->setThumbmime($this->getThumbmime()); $copyObj->setThumbwidth($this->getThumbwidth()); $copyObj->setThumbheight($this->getThumbheight()); $copyObj->setThumbsize($this->getThumbsize()); $copyObj->setDescriptionurl($this->getDescriptionurl()); $copyObj->setDescriptionurlshort($this->getDescriptionurlshort()); $copyObj->setImagedescription($this->getImagedescription()); $copyObj->setDatetimeoriginal($this->getDatetimeoriginal()); $copyObj->setArtist($this->getArtist()); $copyObj->setLicenseshortname($this->getLicenseshortname()); $copyObj->setUsageterms($this->getUsageterms()); $copyObj->setAttributionrequired($this->getAttributionrequired()); $copyObj->setRestrictions($this->getRestrictions()); $copyObj->setTimestamp($this->getTimestamp()); $copyObj->setUser($this->getUser()); $copyObj->setUserid($this->getUserid()); $copyObj->setMissing($this->getMissing()); $copyObj->setKnown($this->getKnown()); $copyObj->setImagerepository($this->getImagerepository()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getC2Ms() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addC2M($relObj->copy($deepCopy)); } } foreach ($this->getM2Ps() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addM2P($relObj->copy($deepCopy)); } } } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
Sets contents of passed object to values from current object. If desired, this method can also make copies of all associated (fkey referrers) objects. @param object $copyObj An object of \Attogram\SharedMedia\Orm\Media (or compatible) type. @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. @throws PropelException
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L2956-L3013
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.getC2Ms
public function getC2Ms(Criteria $criteria = null, ConnectionInterface $con = null) { $partial = $this->collC2MsPartial && !$this->isNew(); if (null === $this->collC2Ms || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collC2Ms) { // return empty collection $this->initC2Ms(); } else { $collC2Ms = ChildC2MQuery::create(null, $criteria) ->filterByMedia($this) ->find($con); if (null !== $criteria) { if (false !== $this->collC2MsPartial && count($collC2Ms)) { $this->initC2Ms(false); foreach ($collC2Ms as $obj) { if (false == $this->collC2Ms->contains($obj)) { $this->collC2Ms->append($obj); } } $this->collC2MsPartial = true; } return $collC2Ms; } if ($partial && $this->collC2Ms) { foreach ($this->collC2Ms as $obj) { if ($obj->isNew()) { $collC2Ms[] = $obj; } } } $this->collC2Ms = $collC2Ms; $this->collC2MsPartial = false; } } return $this->collC2Ms; }
php
public function getC2Ms(Criteria $criteria = null, ConnectionInterface $con = null) { $partial = $this->collC2MsPartial && !$this->isNew(); if (null === $this->collC2Ms || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collC2Ms) { // return empty collection $this->initC2Ms(); } else { $collC2Ms = ChildC2MQuery::create(null, $criteria) ->filterByMedia($this) ->find($con); if (null !== $criteria) { if (false !== $this->collC2MsPartial && count($collC2Ms)) { $this->initC2Ms(false); foreach ($collC2Ms as $obj) { if (false == $this->collC2Ms->contains($obj)) { $this->collC2Ms->append($obj); } } $this->collC2MsPartial = true; } return $collC2Ms; } if ($partial && $this->collC2Ms) { foreach ($this->collC2Ms as $obj) { if ($obj->isNew()) { $collC2Ms[] = $obj; } } } $this->collC2Ms = $collC2Ms; $this->collC2MsPartial = false; } } return $this->collC2Ms; }
Gets an array of ChildC2M objects which contain a foreign key that references this object. If the $criteria is not null, it is used to always fetch the results from the database. Otherwise the results are fetched from the database the first time, then cached. Next time the same method is called without $criteria, the cached collection is returned. If this ChildMedia is new, it will return an empty collection or the current collection; the criteria is ignored on a new object. @param Criteria $criteria optional Criteria object to narrow the query @param ConnectionInterface $con optional connection object @return ObjectCollection|ChildC2M[] List of ChildC2M objects @throws PropelException
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L3169-L3211
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.setM2Ps
public function setM2Ps(Collection $m2Ps, ConnectionInterface $con = null) { /** @var ChildM2P[] $m2PsToDelete */ $m2PsToDelete = $this->getM2Ps(new Criteria(), $con)->diff($m2Ps); //since at least one column in the foreign key is at the same time a PK //we can not just set a PK to NULL in the lines below. We have to store //a backup of all values, so we are able to manipulate these items based on the onDelete value later. $this->m2PsScheduledForDeletion = clone $m2PsToDelete; foreach ($m2PsToDelete as $m2PRemoved) { $m2PRemoved->setMedia(null); } $this->collM2Ps = null; foreach ($m2Ps as $m2P) { $this->addM2P($m2P); } $this->collM2Ps = $m2Ps; $this->collM2PsPartial = false; return $this; }
php
public function setM2Ps(Collection $m2Ps, ConnectionInterface $con = null) { /** @var ChildM2P[] $m2PsToDelete */ $m2PsToDelete = $this->getM2Ps(new Criteria(), $con)->diff($m2Ps); //since at least one column in the foreign key is at the same time a PK //we can not just set a PK to NULL in the lines below. We have to store //a backup of all values, so we are able to manipulate these items based on the onDelete value later. $this->m2PsScheduledForDeletion = clone $m2PsToDelete; foreach ($m2PsToDelete as $m2PRemoved) { $m2PRemoved->setMedia(null); } $this->collM2Ps = null; foreach ($m2Ps as $m2P) { $this->addM2P($m2P); } $this->collM2Ps = $m2Ps; $this->collM2PsPartial = false; return $this; }
Sets a collection of ChildM2P objects related by a one-to-many relationship to the current object. It will also schedule objects for deletion based on a diff between old objects (aka persisted) and new objects from the given Propel collection. @param Collection $m2Ps A Propel collection. @param ConnectionInterface $con Optional connection object @return $this|ChildMedia The current object (for fluent API support)
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L3476-L3500
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.countM2Ps
public function countM2Ps(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { $partial = $this->collM2PsPartial && !$this->isNew(); if (null === $this->collM2Ps || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collM2Ps) { return 0; } if ($partial && !$criteria) { return count($this->getM2Ps()); } $query = ChildM2PQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByMedia($this) ->count($con); } return count($this->collM2Ps); }
php
public function countM2Ps(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { $partial = $this->collM2PsPartial && !$this->isNew(); if (null === $this->collM2Ps || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collM2Ps) { return 0; } if ($partial && !$criteria) { return count($this->getM2Ps()); } $query = ChildM2PQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByMedia($this) ->count($con); } return count($this->collM2Ps); }
Returns the number of related M2P objects. @param Criteria $criteria @param boolean $distinct @param ConnectionInterface $con @return int Count of related M2P objects. @throws PropelException
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L3511-L3534
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.getM2PsJoinPage
public function getM2PsJoinPage(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildM2PQuery::create(null, $criteria); $query->joinWith('Page', $joinBehavior); return $this->getM2Ps($query, $con); }
php
public function getM2PsJoinPage(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildM2PQuery::create(null, $criteria); $query->joinWith('Page', $joinBehavior); return $this->getM2Ps($query, $con); }
If this collection has already been initialized with an identical criteria, it returns the collection. Otherwise if this Media is new, it will return an empty collection; or if this Media has previously been saved, it will retrieve related M2Ps from storage. This method is protected by default in order to keep the public api reasonable. You can provide public methods for those you actually need in Media. @param Criteria $criteria optional Criteria object to narrow the query @param ConnectionInterface $con optional connection object @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) @return ObjectCollection|ChildM2P[] List of ChildM2P objects
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L3607-L3613
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/Media.php
Media.clear
public function clear() { if (null !== $this->aSource) { $this->aSource->removeMedia($this); } $this->id = null; $this->source_id = null; $this->pageid = null; $this->title = null; $this->url = null; $this->mime = null; $this->width = null; $this->height = null; $this->size = null; $this->sha1 = null; $this->thumburl = null; $this->thumbmime = null; $this->thumbwidth = null; $this->thumbheight = null; $this->thumbsize = null; $this->descriptionurl = null; $this->descriptionurlshort = null; $this->imagedescription = null; $this->datetimeoriginal = null; $this->artist = null; $this->licenseshortname = null; $this->usageterms = null; $this->attributionrequired = null; $this->restrictions = null; $this->timestamp = null; $this->user = null; $this->userid = null; $this->missing = null; $this->known = null; $this->imagerepository = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }
php
public function clear() { if (null !== $this->aSource) { $this->aSource->removeMedia($this); } $this->id = null; $this->source_id = null; $this->pageid = null; $this->title = null; $this->url = null; $this->mime = null; $this->width = null; $this->height = null; $this->size = null; $this->sha1 = null; $this->thumburl = null; $this->thumbmime = null; $this->thumbwidth = null; $this->thumbheight = null; $this->thumbsize = null; $this->descriptionurl = null; $this->descriptionurlshort = null; $this->imagedescription = null; $this->datetimeoriginal = null; $this->artist = null; $this->licenseshortname = null; $this->usageterms = null; $this->attributionrequired = null; $this->restrictions = null; $this->timestamp = null; $this->user = null; $this->userid = null; $this->missing = null; $this->known = null; $this->imagerepository = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }
Clears the current object, sets all attributes to their default values and removes outgoing references as well as back-references (from other objects to this one. Results probably in a database change of those foreign objects when you call `save` there).
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/Media.php#L3620-L3662
MindyPHP/Pagination
Handler/RequestPaginationHandler.php
RequestPaginationHandler.getPage
public function getPage($key) { if ($this->request->query->has($key)) { return $this->request->query->getInt($key); } return null; }
php
public function getPage($key) { if ($this->request->query->has($key)) { return $this->request->query->getInt($key); } return null; }
{@inheritdoc}
https://github.com/MindyPHP/Pagination/blob/9f38cc7ac219ea2639b88d9f45351c7b24ea8322/Handler/RequestPaginationHandler.php#L62-L69
MindyPHP/Pagination
Handler/RequestPaginationHandler.php
RequestPaginationHandler.getUrlForQueryParam
public function getUrlForQueryParam($key, $value) { $path = strtok($this->request->getRequestUri(), '?'); $query = array_merge($this->request->query->all(), [ $key => $value, ]); return sprintf('%s?%s', $path, http_build_query($query)); }
php
public function getUrlForQueryParam($key, $value) { $path = strtok($this->request->getRequestUri(), '?'); $query = array_merge($this->request->query->all(), [ $key => $value, ]); return sprintf('%s?%s', $path, http_build_query($query)); }
{@inheritdoc}
https://github.com/MindyPHP/Pagination/blob/9f38cc7ac219ea2639b88d9f45351c7b24ea8322/Handler/RequestPaginationHandler.php#L74-L82
goulaheau/symfony-rest-bundle
Core/RestParams/Expression.php
Expression.addExpression
public function addExpression($expression) { if (!$this->expressions->contains($expression)) { $this->expressions[] = $expression; } return $this; }
php
public function addExpression($expression) { if (!$this->expressions->contains($expression)) { $this->expressions[] = $expression; } return $this; }
@param Expression $expression @return $this
https://github.com/goulaheau/symfony-rest-bundle/blob/688a120540f144aa1033a72b75803fae34ba3953/Core/RestParams/Expression.php#L177-L184
goulaheau/symfony-rest-bundle
Core/RestParams/Expression.php
Expression.removeExpression
public function removeExpression($expression) { if ($this->expressions->contains($expression)) { $this->expressions->removeElement($expression); } return $this; }
php
public function removeExpression($expression) { if ($this->expressions->contains($expression)) { $this->expressions->removeElement($expression); } return $this; }
@param Expression $expression @return $this
https://github.com/goulaheau/symfony-rest-bundle/blob/688a120540f144aa1033a72b75803fae34ba3953/Core/RestParams/Expression.php#L191-L198
Ydle/HubBundle
Controller/RestNodeTypeController.php
RestNodeTypeController.getNodeTypeAction
public function getNodeTypeAction(ParamFetcher $paramFetcher) { $page = $paramFetcher->get('page'); $count = $paramFetcher->get('count'); $pager = $this->getNodeTypeManager()->getPager($this->filterCriteria($paramFetcher), $page, $count); return $pager; }
php
public function getNodeTypeAction(ParamFetcher $paramFetcher) { $page = $paramFetcher->get('page'); $count = $paramFetcher->get('count'); $pager = $this->getNodeTypeManager()->getPager($this->filterCriteria($paramFetcher), $page, $count); return $pager; }
Retrieve the list of available node types @QueryParam(name="page", requirements="\d+", default="1", description="Page for node types list pagination") @QueryParam(name="count", requirements="\d+", default="10", description="Number of nodes by page") @param ParamFetcher $paramFetcher
https://github.com/Ydle/HubBundle/blob/7fa423241246bcfd115f2ed3ad3997b4b63adb01/Controller/RestNodeTypeController.php#L37-L45
Ydle/HubBundle
Controller/RestNodeTypeController.php
RestNodeTypeController.getNodeTypeDetailAction
public function getNodeTypeDetailAction(ParamFetcher $paramFetcher) { $nodetypeId = $paramFetcher->get('nodetype_id'); if (!$result = $this->getNodeTypeManager()->find($nodetypeId)) { return 'ok'; } return $result; }
php
public function getNodeTypeDetailAction(ParamFetcher $paramFetcher) { $nodetypeId = $paramFetcher->get('nodetype_id'); if (!$result = $this->getNodeTypeManager()->find($nodetypeId)) { return 'ok'; } return $result; }
Retrieve the list of available node types @QueryParam(name="nodetype_id", requirements="\d+", default="0", description="Id of the node type") @param ParamFetcher $paramFetcher
https://github.com/Ydle/HubBundle/blob/7fa423241246bcfd115f2ed3ad3997b4b63adb01/Controller/RestNodeTypeController.php#L54-L64
fxpio/fxp-doctrine-extensions
Validator/Constraints/UniqueEntityValidator.php
UniqueEntityValidator.validate
public function validate($entity, Constraint $constraint): void { /** @var UniqueEntity $constraint */ $em = Util::getObjectManager($this->registry, $entity, $constraint); $fields = (array) $constraint->fields; $criteria = $this->getCriteria($entity, $constraint, $em); if (null === $criteria) { return; } $result = $this->getResult($entity, $constraint, $criteria, $em); if (!$this->isValidResult($result, $entity)) { $errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0]; $invalidValue = $criteria[$errorPath] ?? $criteria[$fields[0]]; $this->context->buildViolation($constraint->message) ->atPath($errorPath) ->setInvalidValue($invalidValue) ->addViolation() ; } }
php
public function validate($entity, Constraint $constraint): void { /** @var UniqueEntity $constraint */ $em = Util::getObjectManager($this->registry, $entity, $constraint); $fields = (array) $constraint->fields; $criteria = $this->getCriteria($entity, $constraint, $em); if (null === $criteria) { return; } $result = $this->getResult($entity, $constraint, $criteria, $em); if (!$this->isValidResult($result, $entity)) { $errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0]; $invalidValue = $criteria[$errorPath] ?? $criteria[$fields[0]]; $this->context->buildViolation($constraint->message) ->atPath($errorPath) ->setInvalidValue($invalidValue) ->addViolation() ; } }
Validate. @param object $entity @param Constraint $constraint @throws UnexpectedTypeException @throws ConstraintDefinitionException
https://github.com/fxpio/fxp-doctrine-extensions/blob/82942f51d47cdd79a20a5725ee1b3ecfc69e9d77/Validator/Constraints/UniqueEntityValidator.php#L55-L78
fxpio/fxp-doctrine-extensions
Validator/Constraints/UniqueEntityValidator.php
UniqueEntityValidator.getCriteria
protected function getCriteria($entity, Constraint $constraint, ObjectManager $em) { /** @var UniqueEntity $constraint */ /** @var \Doctrine\ORM\Mapping\ClassMetadata $class */ $class = $em->getClassMetadata(ClassUtils::getClass($entity)); $fields = (array) $constraint->fields; $criteria = []; foreach ($fields as $fieldName) { $criteria = $this->findFieldCriteria($criteria, $constraint, $em, $class, $entity, $fieldName); if (null === $criteria) { break; } } return $criteria; }
php
protected function getCriteria($entity, Constraint $constraint, ObjectManager $em) { /** @var UniqueEntity $constraint */ /** @var \Doctrine\ORM\Mapping\ClassMetadata $class */ $class = $em->getClassMetadata(ClassUtils::getClass($entity)); $fields = (array) $constraint->fields; $criteria = []; foreach ($fields as $fieldName) { $criteria = $this->findFieldCriteria($criteria, $constraint, $em, $class, $entity, $fieldName); if (null === $criteria) { break; } } return $criteria; }
Gets criteria. @param object $entity @param Constraint $constraint @param ObjectManager $em @throws ConstraintDefinitionException @return null|array Null if there is no constraint
https://github.com/fxpio/fxp-doctrine-extensions/blob/82942f51d47cdd79a20a5725ee1b3ecfc69e9d77/Validator/Constraints/UniqueEntityValidator.php#L91-L108
fxpio/fxp-doctrine-extensions
Validator/Constraints/UniqueEntityValidator.php
UniqueEntityValidator.getResult
private function getResult($entity, Constraint $constraint, array $criteria, ObjectManager $em) { /** @var UniqueEntity $constraint */ $filters = SqlFilterUtil::findFilters($em, (array) $constraint->filters, $constraint->allFilters); SqlFilterUtil::disableFilters($em, $filters); $repository = $em->getRepository(ClassUtils::getClass($entity)); $result = $repository->{$constraint->repositoryMethod}($criteria); SqlFilterUtil::enableFilters($em, $filters); if (\is_array($result)) { reset($result); } return $result; }
php
private function getResult($entity, Constraint $constraint, array $criteria, ObjectManager $em) { /** @var UniqueEntity $constraint */ $filters = SqlFilterUtil::findFilters($em, (array) $constraint->filters, $constraint->allFilters); SqlFilterUtil::disableFilters($em, $filters); $repository = $em->getRepository(ClassUtils::getClass($entity)); $result = $repository->{$constraint->repositoryMethod}($criteria); SqlFilterUtil::enableFilters($em, $filters); if (\is_array($result)) { reset($result); } return $result; }
Get entity result. @param object $entity @param Constraint $constraint @param array $criteria @param ObjectManager $em @return array
https://github.com/fxpio/fxp-doctrine-extensions/blob/82942f51d47cdd79a20a5725ee1b3ecfc69e9d77/Validator/Constraints/UniqueEntityValidator.php#L120-L135