CC-2166: Packaging Improvements. Moved the Zend app into airtime_mvc. It is now installed to /var/www/airtime. Storage is now set to /srv/airtime/stor. Utils are now installed to /usr/lib/airtime/utils/. Added install/airtime-dircheck.php as a simple test to see if everything is install/uninstalled correctly.
This commit is contained in:
parent
514777e8d2
commit
b11cbd8159
4546 changed files with 138 additions and 51 deletions
47
airtime_mvc/library/propel/docs/cookbook/Copying-Objects.txt
Normal file
47
airtime_mvc/library/propel/docs/cookbook/Copying-Objects.txt
Normal file
|
@ -0,0 +1,47 @@
|
|||
= Copying Persisted Objects =
|
||||
|
||||
Propel provides the {{{copy()}}} method to perform copies of mapped row in the database. Note that Propel does '''not''' override the {{{__clone()}}} method; this allows you to create local duplicates of objects that map to the same persisted database row (should you need to do this).
|
||||
|
||||
The {{{copy()}}} method by default performs shallow copies, meaning that any foreign key references will remain the same.
|
||||
|
||||
{{{
|
||||
#!php
|
||||
<?php
|
||||
|
||||
$a = new Author();
|
||||
$a->setFirstName("Aldous");
|
||||
$a->setLastName("Huxley");
|
||||
|
||||
$p = new Publisher();
|
||||
$p->setName("Harper");
|
||||
|
||||
$b = new Book();
|
||||
$b->setTitle("Brave New World");
|
||||
$b->setPublisher($p);
|
||||
$b->setAuthor($a);
|
||||
|
||||
$b->save(); // so that auto-increment IDs are created
|
||||
|
||||
$bcopy = $b->copy();
|
||||
var_export($bcopy->getId() == $b->getId()); // FALSE
|
||||
var_export($bcopy->getAuthorId() == $b->getAuthorId()); // TRUE
|
||||
var_export($bcopy->getAuthor() === $b->getAuthor()); // TRUE
|
||||
?>
|
||||
}}}
|
||||
|
||||
== Deep Copies ==
|
||||
|
||||
By calling {{{copy()}}} with a {{{TRUE}}} parameter, Propel will create a deep copy of the object; this means that any related objects will also be copied.
|
||||
|
||||
To continue with example from above:
|
||||
|
||||
{{{
|
||||
#!php
|
||||
<?php
|
||||
|
||||
$bdeep = $b->copy(true);
|
||||
var_export($bcopy->getId() == $b->getId()); // FALSE
|
||||
var_export($bcopy->getAuthorId() == $b->getAuthorId()); // FALSE
|
||||
var_export($bcopy->getAuthor() === $b->getAuthor()); // FALSE
|
||||
?>
|
||||
}}}
|
Loading…
Add table
Add a link
Reference in a new issue