2009-10-15 00:18:36 +04:00
|
|
|
|
2010-03-15 20:19:00 +03:00
|
|
|
# Upgrade from 2.0-ALPHA4 to 2.0-BETA1
|
2010-01-27 01:03:26 +03:00
|
|
|
|
2010-04-13 01:55:41 +04:00
|
|
|
## Console migrated to Symfony Console
|
|
|
|
|
|
|
|
The Doctrine Cli has been replaced by Symfony Console Configuration
|
|
|
|
|
|
|
|
Instead of having to specifiy:
|
|
|
|
|
|
|
|
[php]
|
|
|
|
$cliConfig = new CliConfiguration();
|
|
|
|
$cliConfig->setAttribute('em', $entityManager);
|
|
|
|
|
|
|
|
You now have to configure the script like:
|
|
|
|
|
|
|
|
[php]
|
|
|
|
$helperSet = new \Symfony\Components\Console\Helper\HelperSet(array(
|
|
|
|
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
|
|
|
|
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
|
|
|
|
));
|
|
|
|
|
|
|
|
## Console: No need for Mapping Paths anymore
|
|
|
|
|
|
|
|
In previous versions you had to specify the --from and --from-path options
|
|
|
|
to show where your mapping paths are from the console. However this information
|
|
|
|
is already known from the Mapping Driver configuration, so the requirement
|
|
|
|
for this options were dropped.
|
|
|
|
|
|
|
|
Instead for each console command all the entities are loaded and to
|
|
|
|
restrict the operation to one or more sub-groups you can use the --filter flag.
|
|
|
|
|
|
|
|
## AnnotationDriver is not a default mapping driver anymore
|
|
|
|
|
|
|
|
In conjunction with the recent changes to Console we realized that the
|
|
|
|
annotations driver being a default metadata driver lead to lots of glue
|
|
|
|
code in the console components to detect where entities lie and how to load
|
|
|
|
them for batch updates like SchemaTool and other commands. However the
|
|
|
|
annotations driver being a default driver does not really help that much
|
|
|
|
anyways.
|
|
|
|
|
|
|
|
Therefore we decided to break backwards compability in this issue and drop
|
|
|
|
the support for Annotations as Default Driver and require our users to
|
|
|
|
specify the driver explicitly (which allows us to ask for the path to all
|
|
|
|
entities).
|
|
|
|
|
|
|
|
If you are using the annotations metadata driver as default driver, you
|
|
|
|
have to add the following lines to your bootstrap code:
|
|
|
|
|
|
|
|
$driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__."/Entities"));
|
|
|
|
$config->setMetadataDriverImpl($driverImpl);
|
|
|
|
|
|
|
|
You have to specify the path to your entities as either string of a single
|
|
|
|
path or array of multiple paths
|
|
|
|
to your entities. This information will be used by all console commands to
|
|
|
|
access all entities.
|
|
|
|
|
|
|
|
Xml and Yaml Drivers work as before!
|
|
|
|
|
|
|
|
|
2010-03-29 17:20:41 +04:00
|
|
|
## New inversedBy attribute
|
|
|
|
|
|
|
|
It is now *mandatory* that the owning side of a bidirectional association specifies the
|
|
|
|
'inversedBy' attribute that points to the name of the field on the inverse side that completes
|
|
|
|
the association. Example:
|
|
|
|
|
|
|
|
[php]
|
|
|
|
// BEFORE (ALPHA4 AND EARLIER)
|
|
|
|
class User
|
|
|
|
{
|
|
|
|
//...
|
|
|
|
/** @OneToOne(targetEntity="Address", mappedBy="user") */
|
|
|
|
private $address;
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
class Address
|
|
|
|
{
|
|
|
|
//...
|
|
|
|
/** @OneToOne(targetEntity="User") */
|
2010-03-31 13:58:23 +04:00
|
|
|
private $user;
|
2010-03-29 17:20:41 +04:00
|
|
|
//...
|
|
|
|
}
|
|
|
|
|
|
|
|
// SINCE BETA1
|
|
|
|
// User class DOES NOT CHANGE
|
|
|
|
class Address
|
|
|
|
{
|
|
|
|
//...
|
|
|
|
/** @OneToOne(targetEntity="User", inversedBy="address") */
|
|
|
|
private $user;
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
|
|
|
|
Thus, the inversedBy attribute is the counterpart to the mappedBy attribute. This change
|
|
|
|
was necessary to enable some simplifications and further performance improvements. We
|
|
|
|
apologize for the inconvenience.
|
|
|
|
|
2010-03-15 20:19:00 +03:00
|
|
|
## Default Property for Field Mappings
|
2010-01-27 01:03:26 +03:00
|
|
|
|
2010-03-15 20:19:00 +03:00
|
|
|
The "default" option for database column defaults has been removed. If desired, database column defaults can
|
|
|
|
be implemented by using the columnDefinition attribute of the @Column annotation (or the approriate XML and YAML equivalents).
|
|
|
|
Prefer PHP default values, if possible.
|
2010-01-27 01:03:26 +03:00
|
|
|
|
2010-02-26 00:16:05 +03:00
|
|
|
## Partial Objects
|
|
|
|
|
2010-04-10 02:00:36 +04:00
|
|
|
[TBD: New syntax, results, etc.]
|
2010-03-15 20:19:00 +03:00
|
|
|
|
2010-02-26 00:16:05 +03:00
|
|
|
## XML Mapping Driver
|
|
|
|
|
|
|
|
The 'inheritance-type' attribute changed to take last bit of ClassMetadata constant names, i.e.
|
|
|
|
NONE, SINGLE_TABLE, INHERITANCE_TYPE_JOINED
|
|
|
|
|
2010-03-15 22:38:41 +03:00
|
|
|
## YAML Mapping Driver
|
|
|
|
|
|
|
|
The way to specify lifecycle callbacks in YAML Mapping driver was changed to allow for multiple callbacks
|
|
|
|
per event. The Old syntax ways:
|
|
|
|
|
|
|
|
[yaml]
|
|
|
|
lifecycleCallbacks:
|
2010-03-15 22:39:32 +03:00
|
|
|
doStuffOnPrePersist: prePersist
|
|
|
|
doStuffOnPostPersist: postPersist
|
2010-03-15 22:38:41 +03:00
|
|
|
|
|
|
|
The new syntax is:
|
|
|
|
|
|
|
|
[yaml]
|
|
|
|
lifecycleCallbacks:
|
|
|
|
prePersist: [ doStuffOnPrePersist, doOtherStuffOnPrePersistToo ]
|
|
|
|
postPersist: [ doStuffOnPostPersist ]
|
|
|
|
|
2010-03-15 20:19:00 +03:00
|
|
|
## PreUpdate Event Listeners
|
2010-03-15 01:16:15 +03:00
|
|
|
|
|
|
|
Event Listeners listening to the 'preUpdate' event can only affect the primitive values of entity changesets
|
|
|
|
by using the API on the `PreUpdateEventArgs` instance passed to the preUpdate listener method. Any changes
|
|
|
|
to the state of the entitys properties won't affect the database UPDATE statement anymore. This gives drastic
|
|
|
|
performance benefits for the preUpdate event.
|
|
|
|
|