/** * Finds all objects in the repository. * * @return mixed The objects. */ public function findAll() { // TODO: Implement findAll() method. // Hackety Hack $storage = $this->xem->getStorage(); $storagePath = $storage->getStoragePath(); $storageDir = $storagePath . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $this->getClassName()); $dirHandle = opendir($storageDir); $ids = array(); $pattern = '*.' . $storage->getFileExtension(); while ($handle = readdir($dirHandle)) { if (fnmatch($pattern, $handle)) { $ids[] = basename($handle, '.' . $storage->getFileExtension()); } } $objects = array(); if (!empty($ids)) { foreach ($ids as $id) { $object = $this->find($id); if ($object) { $objects[] = $object; } } } return $objects; }
/** * @param \Doctrine\OXM\XmlEntityManager $xem * @param \Doctrine\OXM\Mapping\ClassMetadataInfo */ public function __construct(XmlEntityManager $xem, ClassMetadata $metadata) { $this->metadata = $metadata; $this->xem = $xem; $this->marshaller = $xem->getMarshaller(); $this->storage = $xem->getStorage(); }