Slave Okay Queries ================== .. note:: ``slaveOkay`` was deprecated in 1.2 - please use `Read Preference `_ instead. Documents ~~~~~~~~~ You can configure an entire document to send all reads to the slaves by using the ``slaveOkay`` flag: .. code-block:: php createQueryBuilder('User') ->slaveOkay(true); $query = $qb->getQuery(); $users = $query->execute(); The data in the query above will be read from a slave. Even if you have a ``@ReferenceOne`` or ``@ReferenceMany`` resulting from the query above it will be initialized and loaded from a slave. .. code-block:: php createQueryBuilder('User') ->slaveOkay(true); $query = $qb->getQuery(); $users = $query->execute(); foreach ($users as $user) { foreach ($user->getAccounts() as $account) { echo $account->getName(); } }