1. Go to this page and download the library: Download coffreo/ceph-odm library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$object = $fileRepository->find(/* ... */);
$objectManager->detach($object);
// You can update (or not) the object properties before saving it
$object->setBin('my-other-content');
$objectManager->persist();
$objectManager->flush();
$object = $fileRepository->find(/* ... */);
$objectManager->detach($object);
$object->setBucket(new \Coffreo\CephOdm\Entity\Bucket('my-bucket-2));
// You can update (or not) the object properties before saving it
$object->setBin('my-other-content');
$objectManager->persist();
$objectManager->flush();
$objects = $fileRepository->findAll(); // All objects of all buckets
$objects = $fileRepository->findBy(['bucket' => 'my-bucket']); // All objects of the bucket
$objects = $fileRepository->findBy(['id' => 'e223fc11-8046-4a84-98e2-0de912d071e9']); // All objects in any bucket of the given id
// Let's set the limit to 10
$objects = $fileRepository->findBy(['bucket' => 'mybucket'], [], 10);
foreach ($objects->getBucketsTruncated() as $bucketName) {
// some files of the bucket $bucketName ('mybucket' in our case) was not returned
}
// It may be necessary to do this call many times. Do this call in a loop until $objects->getBucketsTruncated() returns an empty array.
$objects = $fileRepository->findBy(['bucket' => 'mybucket'], [], null, 1);
$truncated = []
do {
$objects = $fileRepository->findBy([], [], null, $truncated ? 1 : 0);
// Do something with objects
$truncated = $objects->getBucketsTruncated();
} while ($truncated);
$objects = $fileRepository->findByFrom(['bucket' => 'mybucket'], ['mybucket' => 'myid3']);
// Returns files myid4, myid5, myid6... but not myid3
// Since the criteria specifies the bucket, you can even simplify by: findByFrom(['bucket' => 'mybucket'], 'myid3')
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.