Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saved data disapears. #319

Open
e-v-medvedev opened this issue May 20, 2020 · 1 comment
Open

Saved data disapears. #319

e-v-medvedev opened this issue May 20, 2020 · 1 comment

Comments

@e-v-medvedev
Copy link

e-v-medvedev commented May 20, 2020

The same code works fine outside the FixturesBundle and does't work inside it. For example:

$row = new Smartceo\MUnitBundle\Entity\MUnit();
$row->setCode("sd")
->setLabel("sdfs")
->setName("test")
->setGroup("test");
$manager->persist($row);
$manager->flush();

This code with simple entity works with entity manager created this way:

$isDevMode = true;
$proxyDir = null;
$cache = null;
$useSimpleAnnotationReader = false;
$config = Setup::createAnnotationMetadataConfiguration(array(DIR."/src"), $isDevMode, $proxyDir, $cache, $useSimpleAnnotationReader);
// or if you prefer yaml or XML
//$config = Setup::createXMLMetadataConfiguration(array(DIR."/config/xml"), $isDevMode);
//$config = Setup::createYAMLMetadataConfiguration(array(DIR."/config/yaml"), $isDevMode);

$connectionParams = array(
'url' => 'mysql://root2:some_pass@127.0.0.1:3306/smartceo_bpm',
);
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams);
// obtaining the entity manager
$manager = EntityManager::create($conn, $config);

But doesn't work inside this:

class SomeclassFixtures extends Fixture implements FixtureGroupInterface {
public function load(ObjectManager $manager)
{
}
}

No php or mysql error messages found. $row->getId() returns null before manager->flush() and int value after flushing as expected. But i can not found record with Mysql Workbench.
How can it happend.

@e-v-medvedev
Copy link
Author

Problem found. With Doctrine\ORM\EntityManager everything works fine, with Doctrine\Common\Persistence\ObjectManager - not. Some times the last one works as expected, but i do not understend why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant