Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Conversation

dalabarge
Copy link
Contributor

No description provided.

unstoppablecarl and others added 5 commits January 14, 2014 12:18
The validating event works when bound in the boot() function with the following code.

<?php
class Record extends Ardent{
    static public function boot(){
        parent::boot();
        self::validating(function($record){
            // this always works
        });
    }
}

The observable object binding of the validating event only works if the $observables property includes "validating" in its array and is subsequently returned in the array when calling getObservableEvents().

<?php
class Record extends Ardent{
    // only works if this is set
    public $observables = array('validating');
}
class Observer {
    public function validating($model){
        // works if $observables = array('validating');
    }
}

Record::observe(new Observer);

The getObservableEvents() needs to be extended in the Ardent class to work correctly.
Including observable events for 'validating' and 'validated'
…pivotKeys` and `timestamps` are optional named arguments.
@dalabarge
Copy link
Contributor Author

@igorsantos07 I don't have unit tests on these. The pivotKeys and timestamps keys are optional and compatible with Eloquent. The relationships are all defined correctly with corresponding keys to Eloquent's names for arguments. The readme has been updated to reflect the changes.

Hopefully now it'll be ready for release.

#144

@mAAdhaTTah
Copy link

I could use this. :)

@dalabarge
Copy link
Contributor Author

@mAAdhaTTah feel free to use something like this in composer until it's merged:

{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "laravelbook/ardent",
                "version": "2.4.3",
                "source": {
                    "type": "git",
                    "url": "https://github.com/bexarcreativeinc/ardent.git",
                    "reference": "bexarcreativeinc-master"
                },
                "require": {
                    "php": ">=5.3.0",
                    "illuminate/support": "4.x",
                    "illuminate/database": "4.x",
                    "illuminate/validation": "4.x"
                },
                "autoload": {
                    "psr-0": {
                        "LaravelBook\\Ardent": "src/"
                    }
                }
            }
        }
    ]
}

@dalabarge
Copy link
Contributor Author

@mAAdhaTTah and anyone else interested, there is now https://github.com/esensi/model which although does not support relationship bindings with pivot keys and timestamps (yet, it's on the roadmap) does use traits for all this sort of stuff and includes unit tests and an MIT license. Check it out if you want.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants