New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for cleaning entity referencingResultsCache #10

Closed
janedbal opened this Issue Sep 10, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@janedbal

janedbal commented Sep 10, 2013

Currently it is not possible to "refresh" referencing cache inside entity from outside. It could be usefull for such use-cases:

/*
 * @property-read Payment[] $blockingPayments m:belongsToMany m:filter(blockingPayment)
 */
class User extends BaseEntity {

    public function isBlockedByPayment(){
        return !empty($this->blockingPayments);
    }
}

// usage
$wasBlocked = $user->isBlockedByPayment();

$payment->payed = TRUE;
$this->paymentRepo->persist($payment); // might change user's blocking status

$isBlocked = $user->isBlockedByPayment(); // problem: getting data from cache

if($wasBlocked && !$isBlocked) {
    // ublocking action
}

Originally posted in Nette Forum

@Tharos

This comment has been minimized.

Show comment
Hide comment
@Tharos

Tharos Sep 12, 2013

Owner

Here you are b4fb193

I hope I'll release it in 2.0.1 today.

Owner

Tharos commented Sep 12, 2013

Here you are b4fb193

I hope I'll release it in 2.0.1 today.

@Tharos Tharos closed this Sep 12, 2013

@janedbal

This comment has been minimized.

Show comment
Hide comment
@janedbal

janedbal Sep 12, 2013

Thx very much, works fine. Next time you can close an issue by commit :)

janedbal commented Sep 12, 2013

Thx very much, works fine. Next time you can close an issue by commit :)

@Tharos

This comment has been minimized.

Show comment
Hide comment
@Tharos

Tharos Sep 13, 2013

Owner

One day I'll master all these GitHub spells. :)

Owner

Tharos commented Sep 13, 2013

One day I'll master all these GitHub spells. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment