{"action":"created","issue":{"url":"https://api.github.com/repos/simple-mvc-framework/framework/issues/401","labels_url":"https://api.github.com/repos/simple-mvc-framework/framework/issues/401/labels{/name}","comments_url":"https://api.github.com/repos/simple-mvc-framework/framework/issues/401/comments","events_url":"https://api.github.com/repos/simple-mvc-framework/framework/issues/401/events","html_url":"https://github.com/simple-mvc-framework/framework/pull/401","id":125203547,"number":401,"title":"3.0 - ORM Continued..","user":{"login":"tomvlk","id":3877688,"avatar_url":"https://avatars.githubusercontent.com/u/3877688?v=3","gravatar_id":"","url":"https://api.github.com/users/tomvlk","html_url":"https://github.com/tomvlk","followers_url":"https://api.github.com/users/tomvlk/followers","following_url":"https://api.github.com/users/tomvlk/following{/other_user}","gists_url":"https://api.github.com/users/tomvlk/gists{/gist_id}","starred_url":"https://api.github.com/users/tomvlk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomvlk/subscriptions","organizations_url":"https://api.github.com/users/tomvlk/orgs","repos_url":"https://api.github.com/users/tomvlk/repos","events_url":"https://api.github.com/users/tomvlk/events{/privacy}","received_events_url":"https://api.github.com/users/tomvlk/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":51,"created_at":"2016-01-06T15:53:57Z","updated_at":"2016-01-09T12:31:28Z","closed_at":"2016-01-06T16:00:05Z","pull_request":{"url":"https://api.github.com/repos/simple-mvc-framework/framework/pulls/401","html_url":"https://github.com/simple-mvc-framework/framework/pull/401","diff_url":"https://github.com/simple-mvc-framework/framework/pull/401.diff","patch_url":"https://github.com/simple-mvc-framework/framework/pull/401.patch"},"body":"Adding the following:\r\n- Query building for Entity finding\r\n- Complete find methods\r\n- Refactor + cleanup tests, entity etc.\r\n\r\n\r\nHow to fetch entities, all the styles:\r\n```php\r\n$one = Car::find(1); // Find by primary key value\r\n$one = Car::findBy('model', 'Model S'); // Find by simple = compare\r\n$one = Car::findBy('model', '<>', 'Model S'); // Find by simple custom operator compare\r\n$multiple = Car::findMany(array(1, 2)); // Find multiple cars with array of primary key values.\r\n\r\n// Custom queries\r\n$one = Car::find()->where('model', 'Model S')->one(); // Fetch a single Car with where condition\r\n$one = Car::query()->where('model', 'Model S')->one(); // Exactly the same, you can start the query with 2 methods\r\n\r\n$all = Car::find()->where('make', 'IN', array('Tesla', 'BMW'))->all(); // Get all entities with where condition, IN condition.\r\n$all = Car::find()->limit(50)->offset(100)->all(); // Get 50 cars, starting by record 100.\r\n\r\n// Just get all cars from database:\r\n$all = Car::find()->all();\r\n```"},"comment":{"url":"https://api.github.com/repos/simple-mvc-framework/framework/issues/comments/170233595","html_url":"https://github.com/simple-mvc-framework/framework/pull/401#issuecomment-170233595","issue_url":"https://api.github.com/repos/simple-mvc-framework/framework/issues/401","id":170233595,"user":{"login":"LuckyCyborg","id":13488485,"avatar_url":"https://avatars.githubusercontent.com/u/13488485?v=3","gravatar_id":"","url":"https://api.github.com/users/LuckyCyborg","html_url":"https://github.com/LuckyCyborg","followers_url":"https://api.github.com/users/LuckyCyborg/followers","following_url":"https://api.github.com/users/LuckyCyborg/following{/other_user}","gists_url":"https://api.github.com/users/LuckyCyborg/gists{/gist_id}","starred_url":"https://api.github.com/users/LuckyCyborg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LuckyCyborg/subscriptions","organizations_url":"https://api.github.com/users/LuckyCyborg/orgs","repos_url":"https://api.github.com/users/LuckyCyborg/repos","events_url":"https://api.github.com/users/LuckyCyborg/events{/privacy}","received_events_url":"https://api.github.com/users/LuckyCyborg/received_events","type":"User","site_admin":false},"created_at":"2016-01-09T12:31:28Z","updated_at":"2016-01-09T12:31:28Z","body":"@tomvlk I will say you, you so vainglorious, what will happen into bindParams, when used into **Connection::update** for example:\r\n\r\n### First call\r\n\r\n```php\r\n        // Bind fields\r\n        $this->bindParams($stmt, $data, $paramTypes, ':field_');\r\n``'\r\n\r\nwill result into binding of \r\n\r\n```\r\n$statement->bindValue(1, 'admin', PDO::PARAM_STR);\r\n```\r\n\r\n### Second call\r\n\r\n```php\r\n        // Bind values\r\n        $this->bindParams($stmt, $bindParams, $paramTypes);\r\n``'\r\n\r\nwill result into binding of \r\n\r\n```\r\n$statement->bindValue(1, 1, PDO::PARAM_INT);\r\n```\r\n\r\nResult?\r\n\r\n```sql\r\n\r\nUPDATE user SET username=1 WHERE id=1\"\r\n```\r\n\r\n## You see the light?"}}