Hi,
Givin this basics DB schema
create table accounts(
id int(11) auto increment,
name varchar(25),
deleted enum('1','0') default '0'
);
create table contacts(
id int(11) auto increment,
first_name varchar(25),
last_name varchar(25),
deleted enum('1','0') default '0'
);
create table accounts_contacts(
id int(11) auto increment,
id_account int(11),
id_contact int(11),
deleted enum('1','0') default '0'
);
select * from accounts
id | name | deleted
1 | ABC | '0'
select * from contacts
id | first_name | last_name | deleted
1 | Tom | Hanks | '0'
2 | Mel | Gibson | '1'
select * from accounts_contacts
id | id_account | id_contact | deleted
1 | 1 | 1 | '0'
2 | 1 | 2 | '1'
and the entities :
/**
* @Entity @Table(name="accounts")
**/
class Account {
/** @Id @Column(type="integer") @GeneratedValue(strategy="AUTO") **/
protected $id;
/**
* @ManyToMany(targetEntity="Contact")
* @JoinTable(name="accounts_contacts",
* joinColumns={@JoinColumn(name="id_account", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="id_contact",
referencedColumnName="id")}
* )
*/
protected $contacts = null;
........
}
/**
* @Entity @Table(name="contacts")
**/
class Contact{
/** @Column(type="integer") @GeneratedValue **/
protected $id;
............
}
this command $account = $em->find("Account", 1);
will fetch also the contact Mel Gibson, who's deleted
My question plz : how can i modify my entities , so the find command will
fetch only not deleted contacts
thank you
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.