Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .....
- "require": {
- "php": ">=5.3.3",
- "symfony/symfony": "2.2.*",
- "doctrine/orm": "~2.2,>=2.2.3",
- "doctrine/doctrine-bundle": "1.2.*",
- "twig/extensions": "1.0.*",
- "symfony/assetic-bundle": "2.1.*",
- "symfony/swiftmailer-bundle": "2.2.*",
- "symfony/monolog-bundle": "2.2.*",
- "sensio/distribution-bundle": "2.2.*",
- "sensio/framework-extra-bundle": "2.2.*",
- "sensio/generator-bundle": "2.2.*",
- "jms/security-extra-bundle": "1.4.*",
- "jms/di-extra-bundle": "1.3.*",
- "friendsofsymfony/user-bundle": "*",
- "doctrine/doctrine-migrations-bundle": "dev-master",
- "stof/doctrine-extensions-bundle": "~1.1@dev"
- },
- ....
- stof_doctrine_extensions:
- default_locale: en_US
- orm:
- default:
- sluggable: true
- sortable: true
- <?php
- namespace SixStringPearBundleEntity;
- use GedmoMappingAnnotation as Gedmo;
- use DoctrineORMMapping as ORM;
- /**
- * @ORMEntity
- * @ORMTable(name="icon")
- * @ORMHasLifecycleCallbacks()
- */
- class Icon
- {
- ....(other properties and getters/setters)
- /**
- * @var datetime $created
- *
- * @GedmoTimestampable(on="create")
- * @ORMColumn(type="datetime")
- */
- protected $created;
- /**
- * @param datetime $created
- */
- public function setCreated($created)
- {
- $this->created = $created;
- }
- /**
- * @Route("/admin/go")
- */
- public function goAction(){
- $icon = new SixStringPearBundleEntityIcon();
- $icon->setName("shawn");
- $icon->setZip(12345);
- $icon->setType("go");
- $em = $this->getDoctrine()->getManager();
- $em->persist($icon);
- $em->flush();
- }
- An exception occurred while executing 'INSERT INTO icon (name, zip, thumb, created, updated, createdBy_id) VALUES (?, ?, ?, ?, ?, ?)' with params ["shawn", 12345, "go", null, null, null]:
- SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'created' cannot be null
- stof_doctrine_extensions:
- orm:
- default:
- timestampable: true
- stof_doctrine_extensions:
- default_locale: en
- translation_fallback: true
- orm:
- default:
- timestampable: true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement