public function createBundle($fullName, $flushEntities = true)
{
if (strpos($fullName, '/')) {
list($ownerName, $bundleName) = explode('/', $fullName);
$findBy = array('ownerName' => $ownerName, 'name' => $bundleName);
} else {
$findBy = array('name' => $fullName);
}
$bundle = $this->findBundleBy($findBy);
if (!$bundle) {
if (!isset($findBy['ownerName'])) {
$bundle = $this->createEmptyBundle($fullName);
} else {
$bundle = $this->createFullBundle($findBy['name'], $findBy['ownerName']);
}
if (!$bundle) {
return false;
}
$this->entityManager->persist($bundle);
if ($flushEntities) {
$this->entityManager->flush();
}
}
return $bundle;
}