1: <?php
2:
3: /**
4: * Orchestra: A minimalist object-oriented superset for WordPress using Phalcon.
5: *
6: * This source file is subject to the MIT license that is bundled
7: * with this package in the file LICENSE and is available through
8: * the world-wide-web at the following URI:
9: * http://opensource.org/licenses/MIT
10: *
11: * @copyright Akufen Atelier Creatif
12: * @author Nicholas Charbonneau <nicholas@akufen.ca>
13: * @license http://opensource.org/licenses/MIT
14: * @version 0.1.3
15: * @link https://github.com/akufenstudio/orchestra
16: */
17:
18: namespace Akufen\Orchestra\Mvc\Models;
19:
20: /**
21: * Akufen\Orchestra\Mvc\Models
22: *
23: * A model for WordPress posts
24: *
25: * @package Models
26: * @uses \Akufen\Orchestra\Mvc\Posts
27: */
28: class Medias extends Posts
29: {
30: /**
31: * Initialize a post's source & relationships
32: *
33: * @return void
34: */
35: public function initialize()
36: {
37: parent::initialize();
38: }
39:
40: /**
41: * Retrieve a media post by id.
42: *
43: * @param int $id The id of the media we're looking for.
44: *
45: * @return mixed $media The media or false.
46: */
47: public static function findById($id)
48: {
49: return self::findFirst(array(
50: "ID = ?1 AND post_type = 'attachment'",
51: "bind" => array(1 => strval($id))
52: ));
53: }
54: }
55: